# Exercise: Converting seconds
# https://hands-on-computer-science.de/cs/en/items/python-exercise-seconds/
#
# The task and the hints are comments here; the solution is on the page.

# --- Task ---
#
# Write a function `format_duration(seconds)` that gets a number of seconds and
# returns a text that expresses the same duration in hours, minutes and
# seconds, for example `"2 h 5 min 7 s"` for 7507 seconds. The function itself
# prints nothing; it returns the text with `return`. A main program `main` asks
# for the seconds, calls the function and prints the result.

# --- What it should look like ---
#
#   How many seconds? 7507
#   7507 seconds are 2 h 5 min 7 s.

# --- Your program ---
#

def main():
    answer = input("How many seconds? ")
    seconds = int(answer)
    duration = format_duration(seconds)
    print(f"{seconds} seconds are {duration}.")


def format_duration(seconds):
    # Work out hours, minutes and seconds and return the text.
    return ""


main()

# Because `format_duration` returns its result, you can also test it on its
# own. To do so, temporarily replace the last line with
# `print(format_duration(7507))` and compare with the expected result.

# Hint:
# An hour has 3600 seconds. `seconds // 3600` gives the full hours, and
# `seconds % 3600` the seconds left over after that. With this remainder you do
# the same once more with 60 for the minutes.

# Hint:
# Test your function with values whose result you know by heart: 59 seconds, 60
# seconds, 3600 seconds and 3661 seconds.

# --- For the quick ones ---
#
# Extend the function with days, so that 90061 seconds appear as `1 d 1 h 1 min
# 1 s`.
