Module-4 Data Types in Python
Module-4 Data Types in Python
output
list1[0]: physics
list2[1:5]: [2, 3, 4, 5]
LIST-INDEX
languages = ["Python", "Swift", "C++"]
print(prime_numbers)
• list.sort(reverse=True)
# WAPS Sort the list in Descending order
# vowels list
vowels = ['e', 'a', 'u', 'o', 'i']
If you increase the step size, you can step over elements. E.g., a step size
of two means on each step, one element is skipped over. Let’s try
this:
>>> my_list = [1, 2, 3, 4, 5, 6, 7, 8]
>>> my_list[::2] # skip one each time
[1, 3, 5, 7]
Tuples: