Can anyone tell me what is Tuple? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone tell me what is Tuple?

Python

4th Jul 2017, 1:20 PM
Sakshi Priya
Sakshi Priya - avatar
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]
4th Jul 2017, 1:25 PM
Nanda Balakrishnan
+ 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.
4th Jul 2017, 1:22 PM
Nikhil Kumar
Nikhil Kumar - avatar
+ 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
4th Jul 2017, 1:23 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar