Converting seconds with floor division and modulo

A fitness app stores a workout's length as a whole number of seconds and converts it for display with this Python code:


Python
seconds = 7385
hours = seconds // 3600
minutes = (seconds % 3600) // 60
secs = seconds % 60


Give the values stored in hours, minutes and secs, each as an 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 Arithmetic Operators and Expressions Questions: