Recalll beta
  • Add Topic
  • Search
  • Login
Loading...
  • Programming
Import from Url
  • Cat1
  • Cat2
  • Cat3
  • Cat4
  • Cat5
  • Cat2
  • Cat3
  • Cat4
  • Cat5
Rectangle 27 1

Python Tuples


tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = (1, 2, 3, 4, 5 );
tup3 = "a", "b", "c", "d";

A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use parentheses, whereas lists use square brackets.

Creating a tuple is as simple as putting different comma-separated values. Optionally you can put these comma-separated values between parentheses also. For example

Like string indices, tuple indices start at 0, and they can be sliced, concatenated, and so on.

Note Python tuples
Hidden

Discussion

View all 0 Comments
contact | privacy policy | terms of use © 2015-16 recalll Mobile Analytics

Modal header

Body...

Save