ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(int(str(12345)[::-1]) - 12345, 12345 - int(str(12345)[::-1]))
  1. A. 41975 -41975
  2. B. -41967 41976
  3. C. 41976 41967
  4. D. 41976 -41976

Correct answer: D. 41976 -41976

Reversing 12345 gives 54321, and 54321 minus 12345 is 41976. The second value is the negation of the first.

More Python Programming questions

Exams that ask this topic