ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(int('12' * 2) + int('3' * 2), len({'x' * n for n in range(4)}))
  1. A. 1245 3
  2. B. 1215 4
  3. C. 1245 4
  4. D. 1245 5

Correct answer: C. 1245 4

int('1212') + int('33') is 1212 + 33 = 1245. The set has four distinct strings, from the empty string up to 'xxx'.

More Python Programming questions

Exams that ask this topic