4
Question Question 4
The syntax for a tuple with a single item is simply the element enclosed in a pair of matching parentheses as shown below :
t = ("a")
Is the above statement true? Why? Why not ?
Answer
The statement is false. Single item tuple is always represented by adding a comma after the item. If it is not added then python will consider it as a string.
For example:t1 = ("a",)
print(type(t1)) ⇒ tuplet = ("a")
print(type(t)) ⇒ string