ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
s = '12:34:56'
h, m, sec = map(int, s.split(':'))
print(h * 3600 + m * 60 + sec, divmod(h * 3600 + m * 60 + sec, 60))
  1. A. 45296 (755, 16)
  2. B. 45236 (753, 56)
  3. C. 45296 (754, 16)
  4. D. 45296 (754, 56)

Correct answer: D. 45296 (754, 56)

12 hours is 43200 seconds, 34 minutes is 2040 seconds, and 56 seconds gives 45296. divmod by 60 gives 754 minutes and 56 seconds.

More Python Programming questions

Exams that ask this topic