ProgrammingVery hardJEE Advanced · CAT placement
What is printed?
What is printed?
print(int(1e23))
- A. 99999999999999991611392
- B. 100000000000000000000000
- C. 99999999999999990000000
- D. 1e+23
Correct answer: A. 99999999999999991611392
The literal 1e23 is a float, and the nearest double is 99999999999999991611392, not exactly 10**23. int() of a float gives that exact stored value.
More Python Programming questions
- What is printed? python print('x' 0 == '', 'Z' < 'a', '10' < '9', 'apple' < 'Apple')
- What is printed? python print(len('eu0301'), 'é' == 'eu0301')
- What is printed? python print(0b1010 & ~0b10, 0b1010 ^ 0b1111, 1 << 3 | 1, 6 & 3 == 2)
- What is printed? python print(1 << 100 >> 99) try: print(1 >> -1) except ValueError as e: print(e)
- What is printed? python print(len(str(21000)), sum(map(int, str(21000))))
- What is printed? python print(1018 10 // 1018 == 10, type(1018 / 1018))