40 Program to demonstrate List with heterogeneous elements in Python

Program:

#list with heterogeneous elements

x=[501,6.1,True,"python"]

print(x[2])

print(x[3][2])

for p in x:

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


Output:

Program to demonstrate List with heterogeneous elements in Python

Previous
Next Post »