Calculate minutes between day times
Write a function minutes_between that calculates the number of minutes between two given times of the day. The function should take two strings representing the times in the format 'HH:MM' and return the total number of minutes between them. Hint: you may want to extract the hours and minutes from the given strings. To transform a string like
'12'
to the integer 12
, you can use the int('12')
function.def minutes_between(earlier, later):
# complete function here...
print(minutes_between('10:15', '11:16')) # expected output: 61
print(minutes_between('08:00', '19:47')) # expected output: 707
Python
Setting up Python environment...
Output