ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy
What is printed?
What is printed?
print(min('10', '9'), min(10, 9), max('10', '9', key=int))- A. 10 9 10
- B. 9 9 9
- C. 10 9 9
- D. 9 9 10
Correct answer: A. 10 9 10
Strings compare character by character, so '10' < '9' and min gives '10'. Numbers compare numerically, so min(10, 9) is 9. With key=int, max compares 10 and 9 as numbers and returns the original string '10'.
More Python Programming questions
- What is printed? python i = 'x' = [i for i in range(3)] print(i)
- What is printed? python print([y for x in range(5) if (y := x x) > 5])
- What is printed? python print(bin(10).count('1'), (10).bitcount(), (-10).bitcount())
- What is printed? python from collections import Counter print(Counter('abracadabra').mostcommon(3))
- What is printed? python print(float(10 16 + 1) == 10 16, 10 16 + 1 == float(10 16 + 1))
- What is printed? python x = 0 def f(): global x x += 1 return x print(f() + f() 10, x)