ProgrammingModerateTCS NQT · Wipro pattern
What is printed?
What is printed?
print(" ".join(sorted(set("banana"))))- A. a n b
- B. a a a b n n
- C. a b n
- D. b a n
Correct answer: C. a b n
set("banana") is {'b', 'a', 'n'} in some order. sorted returns ['a', 'b', 'n'] and join puts spaces between them.
More Python Programming questions
- 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"))
- What is printed? python print(round(2.5), round(3.5), round(-0.5))
- What is printed? python class A: count = 0 a1, a2 = A(), A() a1.count += 1 print(A.count, a1.count, a2.count)
- What is printed? python a = [[0] 3] 3 a[0][0] = 1 print(a)