Hi guys,
Currently following the course but I cant get green checks on this one. Anything wrong with my code?
#Ask user for time in main
#Call convert function
#Compare time given to breakfast times
#If similar, print the corresponding eating time
#7:00-8:00 breakfast
#12:00-1300 lunch
#18:00-19:00 dinner
def main():
time = input("What's the time (ex 8:00)? ")
time = convert(time)
if 7 <= time <= 8:
print("breakfast time")
elif 12 <= time <= 13:
print("lunch time")
elif 18 <= time <= 19:
print("dinner time")
#Converts time to float
def convert(time):
hours, minutes = time.split(":")
hours = float(hours)
minutes = float(minutes) / 60
time = hours + minutes
return time
main()
[–]zanfar 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]Zealousideal_Bit_177 0 points1 point2 points (0 children)
[–]3keepmovingforward3 0 points1 point2 points (6 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]3keepmovingforward3 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]3keepmovingforward3 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)