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))- A. 45296 (755, 16)
- B. 45236 (753, 56)
- C. 45296 (754, 16)
- 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
- What is printed? python print([x % 3 for x in [-7, -3, 0, 4]])
- What is printed? python def counter(): count = 0 def step(): nonlocal count count += 2 return count return step c1 = counter() c2 =…
- What is printed? python values = {'x': [1, 2], 'y': [3]} total = sum(len(v) for v in values.values()) keys = sorted(values, key=lambda k…
- What is printed? python print(int(' -0012 '), int('+5'), float('-.5'), float('5.'))
- What is printed? python x = 10 y = x y += 1 z = [x] z[0] += 5 print(x, y, z)
- What is printed? python a = list('abc') print(a.index('b'), ''.join(a[::-1]), a.pop(0), a)