I am writing a program in Python where the user inputs a time in a 24 - hour format #:## or ##:##, and if it is between the hours of 7-8, output is breakfast, if it is between the hours of 12-13, output is lunch, and if it is between the hours of 18-19, output is dinner; otherwise nothing is output.
As of now, the program is not printing material whatsoever. I am confused if it is the way I am calling the functions or the messy way I organized the variables. I would like to keep the two separate functions of main() and convert(time).
Here is my code so far. Any help is appreciated:
time = str()
hours = str()
minutes = str()
hours_time = float()
minutes_time = float()
minutes_exact = float()
total_time = float()
def convert(time):
time = str(input("What time is it? "))
hours, minutes = time.split(':')
hours_time = float(hours)
minutes_time = float(minutes)
minutes_exact = (minutes_time / 100)
return hours_time, minutes_exact
def main():
convert(time)
total_time = hours_time + minutes_exact
if 7.0 <= total_time <= 7.6:
print("breakfast time")
elif 12.0 <= total_time <= 12.6:
print("lunch time")
elif 18.0 <= total_time <= 18.6:
print("dinner time")
main()