Python Revision Notes
9. List & Tuple
-
List: Mutable, ordered
-
Tuple: Immutable, ordered
10. Dictionary & Set
List: Mutable, ordered
lst = [1,2,3]
lst.append(4)
Tuple: Immutable, ordered
tup = (1,2,3)
# Dictionary
d = {"name":"Ajm", "age":18}
print(d["name"])
# Set
s = {1,2,3,3}
print(s) # {1,2,3}
Comments
Post a Comment