def main():
time = input("What time is it? ")
hours, minutes = time.split(":")
minutesToHours = float(minutes) / 60
convert(float(hours)+minutesToHours)
def convert(time):
if 7 <= time <= 8:
timetoeat = "breakfast time"
elif 12 <= time <= 13:
timetoeat = "lunch time"
elif 18 <= time <= 19:
timetoeat = "dinner time"
print(timetoeat)
if __name__ == "__main__":
main()
I have done the output needed in this problem but when I checked it in check50 it is mostly poker face that’s why I want to improve this but I don’t know what to do so can anyone help me to improve my code or advice me something? also cs50 require to use “if name == “main“:” even they didn’t teach it so I’m wondering if can anyone explain what does this do in simplest form
New contributor
Paul Albert Mina is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2