All Basic Python Programs:: # Vowels List
All Basic Python Programs:: # Vowels List
# vowels list
index = vowels.index('e')
index = vowels.index('i')
count = vowels.count('p')
# print count
3) Sorting a list:
# vowels list
vowels.sort()
# print vowels
# vowels list
vowels.sort(reverse=True)
ALL BASIC PYTHON PROGRAMS:
# print vowels
def takeSecond(elem):
return elem[1]
# random list
random.sort(key=takeSecond)
# print list
for o in reversed(os):
ALL BASIC PYTHON PROGRAMS:
print(o)
a)Reverse a list:
# List Reverse
os.reverse()
# updated list
# Reversing a list
reversed_list = os[::-1]
# updated list
ALL BASIC PYTHON PROGRAMS:
print('Updated List:', reversed_list)
5) Copy a list:
# mixed list
# copying a list
new_list = list.copy()
new_list.append('dog')
# mixed list
new_list = list[:]
ALL BASIC PYTHON PROGRAMS:
# Adding element to the new list
new_list.append('dog')