# lists and tuples both are sequences starting with 0 indexing
tup = (2, 3, 4, 5)
print(tup[0]) # Output: 2
lst = [12, 13, 14, 15]
print(lst[0]) # Output: 12
# lists and tuples both can be used with for loops
for t in tup:
print(t)
for l in lst:
print(l)
# But lists are mutable and tuples are immutable
lst = [12, 13, 14, 15]
lst[0] = 20
print(lst) # Output: [20, 13, 14, 15]
tup = (2, 3, 4, 5)
# tup[0] = 20 # Output: TypeError: 'tuple' object does not support item assignment
# There are so many modifications that can be done with lists
print(dir(lst))
# ['append', 'clear', 'copy', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort']
# But there are only two modifications that can be done with tuples
print(dir(tup))
# ['count', 'index']
# So then why do we use tuples over lists?
# That is because tuples are more efficient