ProgrammingHardTCS NQT · Infosys pattern

What is printed?

What is printed?
print(f"{10 / 3:.3f}")
print(f"{10 // 3}")
print(f"{2 ** 10:,}")
  1. A. 3.333 3 1,024
  2. B. 3.3 3 1024
  3. C. 3.333 3.33 1,024
  4. D. 3.330 3 1,024

Correct answer: A. 3.333 3 1,024

10/3 to 3 decimal places rounds to 3.333. 10//3 is plain integer floor division, 3. 2**10 is 1024, formatted with a thousands separator as 1,024.

More Python Programming questions

Exams that ask this topic