which of the following is a valid singleton tuple?
1-single=(1)
2-single=1,
3-single=()
4-single=1
Answers
Answered by
0
Answer: (2) single = (1,)
Explanation:
A singleton tuple is a tuple that contains only one element and singleton tuple is also known as 1-tuple.
single = (1, ) This is singleton tuple.
Answered by
0
Answer:
The required answer is: (2) single=1
Explanation:
Put a comma at the end of the element when forming a tuple with just one element. Without a comma, Python will treat the element as a regular data type rather than a tuple. A "Singleton" tuple is one that only contains one element.
A singleton tuple also referred to as a 1-tuple, is a tuple that only has one element.
Therefore, option (2) single=1 is correct.
#SPJ3
Similar questions