ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(0.1 + 0.2 == 0.3 or 'no', 0.5 + 0.25 == 0.75 and 'yes')
- A. no yes
- B. yes no
- C. no no
- D. no False
Correct answer: A. no yes
0.1 + 0.2 == 0.3 is False, so the or returns its right operand 'no'. 0.5 + 0.25 == 0.75 is True, so the and returns 'yes'.
More Python Programming questions
- What is printed? python print(divmod(-7, 3), divmod(7, -3), divmod(-8.5, 4))
- What is printed? python print(abs(-7) // 2 -1, -abs(-7) // 2, -(abs(-7) // 2))
- What is printed? python x = 255 print(f'{x:08b}', f'{x:o}', f'{x:X}', f'{x:#010x}')
- What is printed? python print(int('11', 2) + int('11', 8) + int('11', 16))
- What is printed? python print(round(1234.5678, -2), round(-1234.5678, 2), round(0.000123456, 5))
- What is printed? python print(7 / 7, 0 / 5, -0 / 5, 2 0, 0 0.0)