A tuple is a sequence of immutable Python objects. Tuples are in form of sequences as same as lists. The main differences between tuples and lists is that tuples cannot be changed like lists, also tuples use parentheses whereas lists use square brackets.
For example you can see below code.
tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = (1, 2, 3, 4, 5 );
tup3 = "a", "b", "c", "d";
Output will be
tup1 = (50,);
Note-Like string indices, tuple indices start at 0, and they can be sliced, concatenated, and so on.
0 Comment(s)