Splitting a test duration with // and %

A data logger records the duration of a fatigue test as an integer number of seconds. A Python script splits it into hours, minutes and seconds, and also computes one extra value r:


Python
t = 9275
h = t // 3600
m = (t % 3600) // 60
s = t % 60
r = -t // 3600


Give the value that Python stores in each of h, m, s and r. Each answer is an exact integer.

Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Python Programming Questions: