Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#Write a function called valid_release_date. The function #should have two parameters: a date and a string. The #string will represent a type of media release:

image text in transcribed#Write a function called valid_release_date. The function #should have two parameters: a date and a string. The #string will represent a type of media release: "Game", #"Movie", "Album", "Show", and "Play". # #valid_release_date should check to see if the date is #a valid date to release that type of media according to #the following rules: # # - Albums should be released on Mondays. # - Games should be released on Tuesdays. # - Shows should be released on Wednesdays or Sundays. # - Movies should be released on Fridays. # - Plays should be released on Saturdays. # #valid_release_date should return True if the date is #valid, False if it's not. # #The date will be an instance of Python's date class. If #you have an instance of date called a_date, you can #access an integer representing the day of the week with #a_date.weekday(). a_date.weekday() will return 0 if the #day is Monday, 1 if it's Tuesday, 2 if it's Wednesday, #up to 6 if it's Sunday. # #If the type of release is not one of these strings, #the release date is automatically invalid, so return #False.

28 #False. 29 30 from datetime import date 31 32 #lirite your function here ! 33 def valid release date (a_date (a_date.year, a_date.month, a_date.day), string)): 34 a_date a_date.weekday() 35 36 37 38 39 40 41 42 43 File "ReleaseDates.", line 33 def valid_release date (a_date(a _date.year, a_date.month, a_date.da y), string)): SyntaxError: invalid syntax Command exited with non-zero status if a date.weekday() : a date.weekda if string Alb um return True else: return False if a date.weekday)1: a date.weekday( if stringGame" return True 45 46 47 48 49 50 51 52 53 if a date.weekday4 54 else: return False if a-date . weekday() 2 or a-date . weekday 6: ## -- a date.weekday() if string"Show": else: return True return False a date.weekday( if stringMovie": 56 57 58 59 return True else: return False if a date.weekday)5: 61 62 63 64 a date.weekda string--"Play": else: return True return False 67

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

Students also viewed these Databases questions

Question

Describe the five elements of the listening process.

Answered: 1 week ago