ProgrammingHardTCS NQT · Accenture

What is printed?

What is printed?
print(int('12abc', 36), int('zz', 36), int('-z', 36))
  1. A. 1786296 1295 -35
  2. B. 1786296 1295 -36
  3. C. 1786296 1296 -35
  4. D. 1786297 1295 -35

Correct answer: A. 1786296 1295 -35

Base 36 uses digits 0 to 9 then a to z. 12abc works out to 1786296, zz is 35 * 36 + 35 = 1295, and -z is -35 because the sign applies to the whole number.

More Python Programming questions

Exams that ask this topic