Weekday Name¶
I have provided a function that is supposed to return the name of a day of the week given the day number.
Files Needed¶
Use if, elif and else to complete it according to the following table:
| Number | Weekday Name |
|---|---|
| 1 | Monday |
| 2 | Tuesday |
| 3 | Wednesday |
| 4 | Thursday |
| 5 | Fiday |
| 6 | Saturday |
| 7 | Sunday |
| 0 | Sunday |
| anything else | error |
Save your solution as:
weekday_name.py
What You Should See¶
Weekday 1: Monday
Weekday 2: Tuesday
Weekday 3: Wednesday
Weekday 4: Thursday
Weekday 5: Friday
Weekday 6: Saturday
Weekday 7: Sunday
Weekday 0: Sunday
Weekday 43: error
Weekday 17: error
Weekday -1: error
Today is a Wednesday!
©2021 Daniel Gallo
This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.

Adapted for Python from Graham Mitchell’s Programming By Doing