how to use tupels python

Solutions on MaxInterview for how to use tupels python by the best coders in the world

showing results for - "how to use tupels python"
Lilac
20 Nov 2016
1x = ("apple", "banana", "cherry")
2y = list(x)
3y[1] = "kiwi"
4x = tuple(y)
5
6print(x)
Thibaut
30 Mar 2016
1# A tuple is a sequence of immutable Python objects. Tuples are
2# sequences, just like lists. The differences between tuples
3# and lists are, the tuples cannot be changed unlike lists and
4# tuples use parentheses, whereas lists use square brackets.
5tup1 = ('physics', 'chemistry', 1997, 2000);
6tup2 = "a", "b", "c", "d";
7
8# To access values in tuple, use the square brackets for
9# slicing along with the index or indices to obtain value
10# available at that index.
11tup1[0] # Output: 'physics'
Julia
08 Jan 2018
1tupel = ('banana',10,True)
2print(tupel[2])
Melody
24 Jan 2017
1#It's like a list, but unchangeable
2tup = ("var1","var2","var3")
3tup = (1,2,3)
4#Error
similar questions
queries leading to this page
how to use tupels python