Tuples in Python

Tuples in Python are similar to list data type. It makes use of ( and ). List uses [ and ]. The significant difference is, once we create the Tuples, we cannot modify their contents(Immutable). If we try to change the content, it will throw an error at run time. They uses less memory or storage when compared to the list. So, they are more efficient than list. 

list supports sort() method. But, Tuples doesn’t support sort() method.

Example:

fruits = ( 'Apple', 'Banana', 'Grapes' );
for fruit in fruits :
    print ( fruit );

Leave a Reply