Lists, Tuple, Sets and Dictionaries
Differences
Lists
How to create
list1=[1,4,"Gitam",6,"college"]
list2=[] # creates an empty list
list3=list((1,2,3))
print(list1)
print(list2)
print(list3)Operations on Lists
list1=["hello",1,4,8,"good"]
print(list1)
list1[0]="morning" # assigning values ("hello" is replaced with "morning")
print(list1)
print(list1[4])
print(list1[-1]) # list also allow negative indexing
print(list1[1:4]) # slicing
list2=["apple","mango","banana"]
print(list1+list2) # list concatenationAdd and Remove items
Sort Items
Find Items
Count
Reverse
Tuple
How to create
Operations on Tuples
Add and Remove items
Sort Item
Find Items
Count
Reverse
Sets
How to create
Operations on Sets
Add and Remove items
Sort Items
Find Items
Count
Reverse
Dictionaries
How to create
Operations on Sets
Add and Remove items
Sort Items
Find Items
Count
Reverse
Last updated