ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
x = 10**20
print(x // 3, x / 3 == x // 3, x % 3)
  1. A. 33333333333333333333 True 1
  2. B. 3.3333333333333333e+19 False 1
  3. C. 33333333333333333334 False 2
  4. D. 33333333333333333333 False 1

Correct answer: D. 33333333333333333333 False 1

// on ints stays exact, and 10**20 mod 3 is 1 because 10 is congruent to 1. / produces a float, and comparing a float with an int in Python is exact, so the float 3.33e19 does not equal the true integer quotient.

More Python Programming questions

Exams that ask this topic