0

This code I wrote isn't running. I need help to fix the bug

while True: name_of_month = input('Enter the of month to see the number of days in it or type quit to end the program: \n').capitalize() if name_of_month == 'quit': print('End of Program') elif (name_of_month == 'September' or name_of_month == 'April' or name_of_month == 'June' or name_of_month == 'November'): print(name_of_month, 'has 30days!') elif name_of_month == 'February': print(name_of_month, 'has 28 days and 29 days each leap year') elif name_of_month == 'January' or name_of_month == 'March' or name_of_month =='May' or name_of_month == 'July'or name_of_month == 'August' or name_of_month == 'October' or name_of_month == 'December': print(name_of_month,'has 31 days') break

2/13/2020 11:42:39 AM

Samuel Addo

4 Answers

New Answer

+4

You are capitalizing the input so you need to compare with 'Quit' and need a break after printing "End of Program" And your program will not work properly at Sololearn See this link https://code.sololearn.com/WhiNb9BkJUVC/?ref=app

+1

Seems to be working. What is the problem? Edit. OK maybe because in SL you cannot have inputs during code running. All inputs must be delivered at the begining.

+1

Thank you Mihai Apostol it worked

0

Samuel Addo You're welcome.