List!
List is a mutable type!
List can hold different types!
List can hold list itself!
Works similar to string slicing!
myList=[5,10,15,25,30]
print(myList) # [5,10,15,25,30]
myList[3]=20
print(myList)# [5,10,15,20,25,30]
Nested Lists:
myNestedList=[[4,2,1],[38,29,19]]
print(myNestedList[1][1]) #picks up 1st Index list and then 1st index element
List can hold different types!
List can hold list itself!
Works similar to string slicing!
myList=[5,10,15,25,30]
print(myList) # [5,10,15,25,30]
myList[3]=20
print(myList)# [5,10,15,20,25,30]
Nested Lists:
myNestedList=[[4,2,1],[38,29,19]]
print(myNestedList[1][1]) #picks up 1st Index list and then 1st index element
Comments
Post a Comment