ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(1_000_000 == 10 ** 6, 0x_1F, 1e3 == 1000)
  1. A. False 31 True
  2. B. True 31 True
  3. C. True 1F True
  4. D. True 31 False

Correct answer: B. True 31 True

Underscores are allowed between digits, and after a base prefix. 0x_1F is 31 and 1e3 is the float 1000.0, which equals 1000.

More Python Programming questions

Exams that ask this topic