44 Program for tuple with different elements in Python

Program:

#tuple with different elements

x=((10,20,30),[40,50,60],"hello",4.5,True) #here elements of a tuple can be either mutable/immutable

print(x)

print(len(x))

for p in x:

    print(p,type(p),id(p))



y=10

print(y,id(y),type(y))



print(x[0][0],id(x[0][0]),type(x[0][0]))


Output:

Program for tuple with different elements in Python

Previous
Next Post »