For this problem assume the following assignment statement has been executed . W
ID: 3561083 • Letter: F
Question
For this problem assume the following assignment statement has been executed . Weekdays = { ? Sunday? : 0 , ?Monday? : 1, ?Tuesday? : 2, ?Wednesday? : 3, ?Thursday?: 4, ?Friday? : 5, ?Saturday? : 6 } Assume the variable day contains a value that may or may not be the name of a day. Write an assignment statement using get that assigns to day_num the day contains the name of a day and -1 otherwise. For example, if day is ?Wednesday? then day_num should be 3 and if day is ? Talk like a Pirate Day? the day_num should be -1.Explanation / Answer
day_num = weekdays.get(day)
if day_num==None:
day_num=-1
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.