Question

Write a function called “hour_to_seconds” that would convert from hour to seconds. It will have one parameter “hour”. It will return a number of seconds for the number of hours passed in the function parameter. For example, if I call “hourToSeconds(2)”, this function will return 7200. Which you get from 2 hours X 60 minutes X 60 seconds. After you get the result from the function, print the result to the screen

Answer

def hour_to_seconds(hour):
   return hour * 60 * 60

result = hour_to_seconds(2)
print(f'There are {result} seconds in 2 hours.')