ProgrammingVery hardJEE Main · CAT placement
What is printed?
What is printed?
print(int('٣') + 1)- A. ValueError
- B. 3
- C. TypeError
- D. 4
Correct answer: D. 4
Python's int() accepts any Unicode decimal digit, not just ASCII 0 to 9. The Arabic-Indic digit ٣ has the value 3, so the result is 4.
More Python Programming questions
- What is printed? python print(bin(10)[2:].zfill(8), format(-10, '08b'), format(-10 & 0xFF, '08b'), f'{255:#x}')
- What is printed? python print((1 << 70).bitcount(), (270 - 1).bitcount(), (-1).bitcount(), (-8).bitcount())
- What is printed? python print(f'{0.1:.20f}', f'{1e16:g}', f'{123456789.0:e}', f'{2.5:.0f}', f'{3.5:.0f}')
- What is printed? python n = float('nan') print(n in [n], [n] == [n], n == n, n is n)
- What is printed? python print(sum([0.1, 0.2, 0.3]) == 0.6, 0.1 + 0.2 + 0.3 == 0.6, 0.3 + 0.2 + 0.1 == 0.6)
- What is printed? python print(7.5 // 2, 7.5 % 2, -7.5 // 2, divmod(7.5, -2))