Class 3
Class 3
6. List:
*mutable
* order is preserved
* duplicates are allowed. list = [10, 45, 34, 10, 10, True, ’god’]
7.Tuple:
* tuple is mentioned in ()
• Mentioned in {}
• Duplicates not allowed
• Order is not preserved
• Indexing, slicing not available (since no order)
• Mutable
• s = {1,2,4,’moon’}
s.add(50)
s.remove(3)
* immutable
fs = frozenset(s)
print(fs)
* {}
* growable in nature
* d = {}
* d[1] = ‘dog’
e.g code:
d = {}
d[1] = 'dog'
d[2] = 23
d[3] = True
print(d)