Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help on this part Finally, we will create a (very simplified) day of the

ID: 669740 • Letter: I

Question

I need help on this part

Finally, we will create a (very simplified) day of the week calculator. Ask the user to enter a day of the Month. For the input to this question, you can assume the following: The user will enter a number. You cannot assume that the number will be valid! We will assume the month starts on Monday and has 31 days. If the day of the month the user entered is not a valid day of the month (less than 1 or greater than 31), print "Invalid day" to the user. Otherwise print the day of the week that day falls on. For instance, the 2nd would be a Tuesday, the 10th would be a Wednesday, etc. Here is some sample output. (Yours does not have to match this exactly.) bash-4.1$ python hw3_part5.py Please enter the day of the month: 0 Invalid day bash-4.1$ python hw3_part5.py Please enter the day of the month: 9 Today is a Tuesday! bash-4.1$ python 3_part5.py Please enter the day of the month: 24 Today is a Wednesday!

Explanation / Answer

def datetoday(day, month, year):
d = day
if 31< d < 1 :
Print('invalid date')
  
dayofweek = d%7
return dayofweek

months = [ 'january', 'february', 'march', 'april', 'may', 'june', 'july',
'august', 'september', 'october', 'november', 'december' ]

days =[ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
'Sunday' ]

If dayofweek=0:
Print('Sunday')
Elseif dayofweek=2:
Print('Monday')

Elseif dayofweek=3:
Print('Tuesday')

Elseif dayofweek=4:
Print('Wednesday')

Elseif dayofweek=5:
Print('Thursday')

Elseif dayofweek=6:
Print('Friday')

Elseif dayofweek=7:
Print('Saturday')

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote