Python list and tuple, both of them consists of multiple objects identified its position.

list

L=[1, 2, 3]

tuple

T=(1,2,3)

Difference between them is that tuple is immutable.

That is,

L[0]=100

is OK, but

T[0]=100

is not allowed.

Python tuple

consist of a number of objects which can be referenced by their position number within the object.

———

e.g.,

fruit = (“Apple”,”Banana”,”Cherry”,”Fig”,”Grapefruit”)

© 2011 Web Oom Suffusion theme by Sayontan Sinha
Switch to our mobile site
Top Footer