Advertisements
Advertisements
Question
What is a Tuple? Give an example.
Advertisements
Solution
A tuple is a comma-separated sequence of values surrounded by parentheses. A tuple is similar to a list. The difference between the two is that you cannot change the elements of a tuple once it is assigned whereas, in a list, elements can be changed.
Example colour = (‘red’, ‘blue’, ‘Green’)
APPEARS IN
RELATED QUESTIONS
The data structure which is a mutable ordered sequence of elements is called ______
A sequence of immutable objects is called ______
Bundling two values together into one can be considered as ______
Which of the following allows to name the various parts of a multi-item object?
What is a List? Give an example.
What is a List? Why List can be called as Pairs. Explain with a suitable example?
What are the different ways to access the elements of a list? Give example.
Identify Which of the following is List, Tuple, and class?
arr (1, 2, 34)
Identify Which of the following is List, Tuple, and class?
student [rno, name, mark]
Identify Which of the following is List, Tuple, and class?
day = (‘sun’, ‘mon’, ‘Tue, ‘wed’)
