ProgrammingHardTCS NQT · Wipro pattern
What is printed?
What is printed?
print(min(3, 2.0, True), max(1, 1.0), max(1.0, 1))
- A. 1 1 1.0
- B. True 1.0 1
- C. True 1 1.0
- D. 1 True 1
Correct answer: C. True 1 1.0
True equals 1, and it is the smallest of the three numbers. max() returns the first of equal maxima, so max(1, 1.0) is 1 and max(1.0, 1) is 1.0.
More Python Programming questions
- What is printed? python print(253 == float(253), 253 + 1 == float(253 + 1), 253 + 2 == float(253 + 2))
- What is printed? python s = 'atbnc' print(len(s), s.split(), s.split('n'), repr(s.split()[0]))
- What is printed? python from fractions import Fraction print(Fraction(3, 6), Fraction('0.75'), Fraction(0.75), Fraction(1, 3) +…
- What is printed? python print(divmod(7, 2.5), divmod(-7.5, 2))
- What is printed? python print(0.1 + 0.1 + 0.1 == 0.3, 0.1 + 0.1 + 0.1, 0.3 == 3 0.1)
- What is printed? python print(bin(5 ^ 3), bin(-5 & 0b1111), int('-0b101', 2))