ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(f"{0.1:.20f}")
  1. A. 0.10000000000000000555
  2. B. 0.10000000000000000000
  3. C. 0.10000000000000001000
  4. D. 0.1000000000000000055511

Correct answer: A. 0.10000000000000000555

Formatting with .20f shows the exact binary value of 0.1, which is 0.1000000000000000055511151231257827... rounded to 20 places. The decimal literal 0.1 is not stored exactly, which matters in digit-sensitive problems.

More Python Programming questions

Exams that ask this topic