Skip to the content

Minutes to hours

Problem

Write a function that takes an amount of minutes (0 or more) and returns a text with the whole hours and the minutes left over, in this format: 135 minutes give "2 h 15 min".

Both parts always show up: 45 minutes give "0 h 45 min" and 60 minutes give "1 h 0 min".

Examples

  • 135 → "2 h 15 min"

  • 45 → "0 h 45 min"

  • 60 → "1 h 0 min"

Besides these, the challenge has hidden tests that are revealed when you submit your solution.

You start with this

Python

def minutes_to_hours(minutes):
    pass

JavaScript

function minutesToHours(minutes) {
}
Solve this challenge

It opens in your browser, with the editor and the tests. It is free and you do not need an account to start.

More O(1) challenges

See all challenges →