Tuples in Python
What are Tuples?
Tuples are defined as an immutable collection of objects and cannot be changed, unlike lists. Tuples use parenthesis.
Code Example
tuples = ('earth', 'water','air','fire'); tuples2 = (500,800,600,700,650,850 ); print "tuples[1]: ", tuples[1]; print "tuples2[1:4]: ", tuples2[1:4];
Code Example 2
tuple_start = () print(tuple_start) tuple_start = (600,400,800) print(tuple_start) tuple_start = ("Start",500,14) print(tuple_start)
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
What are Tuples?
Tuples are defined as an immutable collection of objects and cannot be changed, unlike lists. Tuples use parenthesis.
Code Example
Code Example 2
need an explanation for this answer? contact us directly to get an explanation for this answer