Q:

Introduction to Tuples in Python

0

Tuples in Python

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now