ProgrammingModerateTCS NQT · Wipro pattern

What is printed?

What is printed?
t = (1,)
print(type(t).__name__, type((1)).__name__)
  1. A. int int
  2. B. tuple tuple
  3. C. int tuple
  4. D. tuple int

Correct answer: D. tuple int

The comma makes a tuple, not the brackets. (1,) is a one-element tuple, while (1) is just the integer 1 in grouping brackets.

More Python Programming questions

Exams that ask this topic