Jul-27-2020, 09:41 AM
I have the following programme:
n = input("Enter a number 0 to 6: ") day_of_the_week = n def day_of_the_week (): if n == 0: return "Sunday" elif n == 1: return "Monday" elif n == 2: return "Tuesday" elif n == 3: return "Wednesday" elif n ==4: return "Thursday" elif n == 5: return "Friday" elif n == 6: return "Saturday" else: return "Invalid number" print("The day of the week is ", n)The out put I get is:
Output:Python 3.8.4 (tags/v3.8.4:dfa645a, Jul 13 2020, 16:46:45) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
= RESTART: C:/Users/John/Documents/John''s files/Work/Coding/Think Like a Computer Scientist/Programmes/day_of_the_week.py
Enter a number 0 to 6: 4
The day of the week is 4
>>>
Could anyone please advise what I am doing wrong?