{}
run-icon
main.py
def timeToEat(currentTime): hours, everythingElse = currentTime.split(":") minutes, pmAm = everythingElse.split(" ") tempMinutes = 60-int(minutes) hoursInteger = int(hours) if tempMinutes == 60: tempMinutes = 0 if tempMinutes != 0: hoursInteger = hoursInteger+1 if hoursInteger > 7 and pmAm == "p.m.": tempHours = 7+(12-hoursInteger) elif hoursInteger < 7: tempHours = 7-hoursInteger else: tempHours = 12-hoursInteger print(tempHours, tempMinutes) timeToEat("2:00 p.m.") #5 hours until the next meal, dinner #output = [5, 0] timeToEat("5:50 a.m.") # 1 hour and 10 minutes until the next meal, breakfast #output = [1, 10]
Output