0
Can anyone tell me what is Tuple?
3 Answers
+ 3
A tuple is immutable objects in python.
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:
tup1 = ('physics', 'chemistry', 1997, 20);
tuple can be accessed by
print "tup1[0]: ", tup1[0]
+ 4
In programming languages, such as Lisp, Python, Linda, and others, a tuple (pronounced TUH-pul) is an ordered set of values. The separator for each value is often a comma (depending on the rules of the particular language). Common uses for the tuple as a data type are (1) for passing a string of parameters from one program to another, and (2) representing a set of value attributes in a relational database. In some languages, tuples can be nested within other tuples within parentheses or brackets or other delimiters. Tuples can contain a mixture of other data types.
+ 2
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.
taken from https://cheeze.club/yhpi