Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, please provide a step-by-step solution, thanks. Question 3a (4 points) Inky, Blinky, Pinky and Clyde are going to the local arcade, but they have

Hello, please provide a step-by-step solution, thanks.

image text in transcribedimage text in transcribedimage text in transcribed

Question 3a (4 points) Inky, Blinky, Pinky and Clyde are going to the local arcade, but they have overly complicated rules for determining who gets to play pinball for the day. Every day there is only one person playing. Inky gets to play pinball on days that start with the letter "T". Blinky gets to play pinball on days that follow days that start with the letter S. Pinky always gets to play pinball on a day of the month divisible by 4, regardless of what day of the week it is Clyde only gets to play pinball if both Inky and Blinky have already played that week, and if Pinky does not get to play that day. Write a python function which takes two arguments (the day of the week in string format and the day of the month in numerical format) and returns the name of the person that gets to play pinball that day. (The start of a week is Sunday.) In [ ]: def pinball (dayOfWeek, dayOfMonth) : return ans In [ ]: # Your Provided Sample Test Cases print("#1", pinball("Sunday", 31) -- "Blinky") print("#2", pinball("Wednesday",28) == "Pinky") print("#3", pinball ("Friday", 15) == "Clyde") Question 3b (4 points) Using the function you wrote in part 3a), write another function that, given the day that the month starts on and the number of days in that given month, returns the number of days that Inky, Blinky, Pinky and Clyde will get to play pinball in that month. Your function should return a tuple of integers with the respective signature ordering (Inky, Blinky,Pinky Clyde). The function provided will increment the day of the week to the next correct day. Use it wisely! In [ ]: def incDay (day) : if (day == "Sunday"): return "Monday" elif (day ="Monday") : return "Tuesday" elif (day == "Tuesday") : return "Wednesday" elif (day == "Wednesday") : return "Thursday" elif (day == "Thursday") : return "Friday" elif (day == "Friday") : return "Saturday" elif (day == "Saturday") : return "Sunday" def playCount (startingDay, daysInMonth) : # your code here return ans In [ ]: # Your Provided Sample Test Cases print("#1", playCount("Sunday", 31) == 17,8,7,9)) print("#2", playCount("Wednesday", 30) == (7,6,7,10)) print("#3", playCount("Wednesday",0) == (0,0,0,0)) # Obviously there does not exist a month with 0 days, but that should not stop your function from behaving correctly Question 3c: (1 point) Who gets to play the most pinball on any given month? In [ ]: def question3c (): # ans = "Inky" # ans = "Blinky" # ans = "Pinky" # ans = "Clyde" return ans In [ ]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions