ProgrammingModerateTCS NQT · Wipro pattern
What is printed?
What is printed?
t = (1,) print(type(t).__name__, type((1)).__name__)
- A. int int
- B. tuple tuple
- C. int tuple
- 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
- What is printed? python def f(args, kw): print(len(args), len(kw)) f(1, 2, a=3)
- What is printed? python print(list(zip([1, 2, 3], "ab")))
- What is printed? python print(" ".join(sorted(set("banana"))))
- What is printed? python try: print(1 / 0, end=" ") except ZeroDivisionError: print("Z", end=" ") finally: print("F")
- What is printed? python print(list(range(10, 0, -3)))
- What is printed? python print(max("apple", "Banana", "cherry"))