Computer Science, asked by oneone953953, 1 month ago

Which of the following is/are valid declaration of a tuple?
a) (1,2,3,[8,9])
b) (1,2,3,’Good’)
c) (11,)
d) (111)

Answers

Answered by anindyaadhikari13
6

ANSWER.

  • All except fourth option is a valid tuple.

EXPLANATION:

  • A tuple is an type of list which is ordered and unchangeable. Tuples  are enclosed within round brackets. If there is only 1 element present for the tuple, then it will not be considered as tuple unless we write a comma after the element. So, here, first three options are valid and the fourth one is invalid.
  • We can also check our result by using type() method. See the attachment.
  • Note: Tuples can be nested, we can also store list inside a tuple.
Attachments:
Similar questions