List and tuple regarding Quiz - Inserting a string in a tuple: as , is not mentioned in the box

In Quiz 4, since “foo” is present in the box and , is present outside box, we have not considered , inside tuple. Attaching snap for your reference.

2 Likes

@shams55663377

Option 1 is correct, because we can define tuple like that with a single element.

Tuple with one element. If the tuple contains only one element, then it’s not considered as a tuple. It should have a trailing comma to specify the interpreter that it’s a tuple

Option 2 is wrong because it is considered as a string only
Option 3 is wrong beacuse it is considered as list.
Option 4 is wrong beacuse it is considered as string .

1 Like