# List vs Tuple in Python

List are mutable and Tuples are immutable. Both can contain different data types.

If we want to add or remove any element in tuple then we will have to first convert it into list then apply the changes and have to convert back it to the tuples. However we can concatenate tuples.

l=\[3,4,9,1,6\]

l.append(10) # will add 10 in the list

l.sort() # sort in ascending order

print(l)

l.sort(reverse=True) # sort in descending order

print(l)

print(l.count(9)) # will count the no. of occurrence of 9 in list

l.reverse() # reverse the string

print(l)

print(l.index(3))

m=l.copy() # copy l list into m

m\[0\]=45

print(m)

l.insert(2,788) # it will insert 788 in 2nd index

print(l)

n=\[100,200,500\]

l.extend(n) # it will add n list to l

print(l)

k=l+m # concatenate the list

print(k)

tup=(1,2,3,4,5,"green",True)

print(type(tup))

print(tup\[0\])

print(tup\[-2\])

if 3 in tup:

print("yes")

tup2=tup\[1:3\]

print(tup2,tup)
