+ 2

What is problem in this code? I just want to use that list but it isn't running.

dictionary_time = { "12am": "morning", "1am": "morning", "2am": "morning", "3am": "morning", "4am": "morning", "5am": "morning", "6am": "morning", "7am": "morning", "8am": "morning", "9am": "morning", "10am": "morning", "11am": "morning", "12pm": "morning", "1pm": "afternoon", "2pm": "afternoon", "3pm": "afternoon", "4pm": "afternoon", "5pm": "evening", "6pm": "evening", "7pm": "evening", "8pm": "evening", "9pm": "night", "10pm": "night", "11pm": "night"} dictionary_digits = { "1": "one", "2": "two", "3": "three", "4": "four", "5": "five", "6": "six", "7": "seven", "8": "nine"} start_wishing_time =['12am', '1am', '2am', '3am', '4am', '5am', '6am', '7am', '8am', '9ma', '10am', '11am', '12pm', '1pm', '2pm', '3pm', '4pm', '5pm', '6pm', '7pm', '8pm'] while True: name = str(input("what is your name?")) time = str(input("what is the time being now means morning, evening or night? ")) if time == start_wishing_time.tuple: print('good ' + dictionary_time.get(time) + ' ' + name) else: break

20th Aug 2019, 7:37 AM
Avinash
Avinash - avatar
3 Respostas
+ 1
if time in start_wishing_time: #####
20th Aug 2019, 7:46 AM
Trigger
Trigger - avatar
+ 1
break will raise an error because there is no loop
20th Aug 2019, 7:47 AM
Trigger
Trigger - avatar