You can take advantage of using dict in order to avoid long/multiple if/elif/else
def day_of_the_week(n): week = {'0':'Sunday', '1':'Monday', '2':'Tuesday', '3':'Wednesday', '4':'Thursday', '5':'Friday', '6':'Saturday'} return week.get(n, 'Invalid number') n = input("Enter a number 0 to 6: ") print(f'The day of the week is {day_of_the_week(n)}')
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs