all list types in python code example
Example 1: python list
# example of list in python
myList = [9, 'hello', 2, 'python']
print(myList[0]) # output --> 9
print(myList[-3]) # output --> hello
print(myList[:3]) # output --> [9, 'hello', 2]
print(myList) # output --> [9, 'hello', 2, 'python']
Example 2: list in python
#list is data structure
#used to store different types of data at same place
list = ['this is str', 12, 12.2, True]