7.19 Please use Python correctly thanks!  def is_valid_month(date_list):     """     The function ...     """     # TODO: Finish the function      def is_valid_day(date_list):     """     The function ...     """     num_days = {         1: 31,         2: 28,         3: 31,         4: 30,         5: 31,         6: 30,         7: 31,         8: 31,         9: 30,         10: 31,         11: 30,         12: 31     }     # TODO: Finish the function      if __name__ == "__main__":

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

7.19 Please use Python correctly thanks! 

def is_valid_month(date_list):
    """
    The function ...
    """
    # TODO: Finish the function
    
def is_valid_day(date_list):
    """
    The function ...
    """
    num_days = {
        1: 31,
        2: 28,
        3: 31,
        4: 30,
        5: 31,
        6: 30,
        7: 31,
        8: 31,
        9: 30,
        10: 31,
        11: 30,
        12: 31
    }
    # TODO: Finish the function
    

if __name__ == "__main__":
    # test incorrect types
    assert is_valid_month([12, 31, 2021]) == False
    assert is_valid_day([12, 31, 2021]) == False
    assert is_valid_year([12, 31, 2021]) == False
    
    # test the correct input
    assert is_valid_month(["01", "01", "1970"]) == True
    assert is_valid_month(["12", "31", "2021"]) == True
    assert is_valid_day(["02", "03", "2000"]) == True
    assert is_valid_day(["12", "31", "2021"]) == True
    assert is_valid_year(["10", "15", "2022"]) == True
    assert is_valid_year(["12", "31", "2021"]) == True

    ### test the edge cases
    assert is_valid_month(["21", "01", "1970"]) == False
    assert is_valid_month(["-2", "31", "2021"]) == False
    assert is_valid_month(["March", "31", "2021"]) == False
    assert is_valid_day(["02", "33", "2000"]) == False
    assert is_valid_day(["02", "31", "2021"]) == False
    assert is_valid_day(["02", "1st", "2021"]) == False
    assert is_valid_day(["14", "1st", "2021"]) == False
    assert is_valid_year(["10", "15", "22"]) == False
    assert is_valid_year(["12", "31", "-21"]) == False

Instructions
Write a function is_valid_month(date_list) that takes as a parameter a list of strings in the [MM, DD, YYYY] format and returns
True if the provided month number is a possible month in the U.S. (i.e., an integer between 1 and 12 inclusive).
Write a function is_valid_day (date_list) that takes as a parameter a list of strings in the [MM, DD, YYYY] format and returns True if
the provided day is a possible day for the given month. You can use the provided dictionary. Note that you should call is_valid_month()
within this function to help you validate the month.
Write a function is_valid_year (date_list) that takes as a parameter a list of strings in the [MM, DD, YYYY] format and returns True
if the provided year is a possible year: a positive integer. For the purposes of this lab, ensure that the year is also greater than 1000.
Test Your Code
#test incorrect types
assert is_valid_month([12, 31, 2021]) == False
assert is_valid_day ([12, 31, 2021]) == False
assert is_valid_year ([12, 31, 2021]) == False
Make sure that the input is of the correct type
assert is_valid_month(["01", "01", "1970"]) == True
assert is_valid_month ( ["12", "31", "2021"])
== True
assert is_valid_day (["02", "03", "2000"]) == True
assert is_valid_day (["12", "31", "2021"]) == True
assert is_valid_year (["10", "15", "2022"]) == True
assert is_valid_year (["12", "31", "2021"]) == True
Now, test the edge cases of the values:
assert is_valid_month(["21", "01", "1970"]) == False
assert is_valid_month(["-2", "31", "2021"]) == False
assert is_valid_month(["March", "31", "2021"]) == False
assert is_valid_day (["02", "33", "2000"]) == False
assert is_valid_day (["02", "31", "2021"]) == False
assert is_valid_day (["02", "1st", "2021"]) == False
assert is_valid_day(["14", "1st", "2021"]) == False
assert is_valid_year (["10", "15",
assert is_valid_year (["12", "31", "-21"]) == False
"22"]) == False
Transcribed Image Text:Instructions Write a function is_valid_month(date_list) that takes as a parameter a list of strings in the [MM, DD, YYYY] format and returns True if the provided month number is a possible month in the U.S. (i.e., an integer between 1 and 12 inclusive). Write a function is_valid_day (date_list) that takes as a parameter a list of strings in the [MM, DD, YYYY] format and returns True if the provided day is a possible day for the given month. You can use the provided dictionary. Note that you should call is_valid_month() within this function to help you validate the month. Write a function is_valid_year (date_list) that takes as a parameter a list of strings in the [MM, DD, YYYY] format and returns True if the provided year is a possible year: a positive integer. For the purposes of this lab, ensure that the year is also greater than 1000. Test Your Code #test incorrect types assert is_valid_month([12, 31, 2021]) == False assert is_valid_day ([12, 31, 2021]) == False assert is_valid_year ([12, 31, 2021]) == False Make sure that the input is of the correct type assert is_valid_month(["01", "01", "1970"]) == True assert is_valid_month ( ["12", "31", "2021"]) == True assert is_valid_day (["02", "03", "2000"]) == True assert is_valid_day (["12", "31", "2021"]) == True assert is_valid_year (["10", "15", "2022"]) == True assert is_valid_year (["12", "31", "2021"]) == True Now, test the edge cases of the values: assert is_valid_month(["21", "01", "1970"]) == False assert is_valid_month(["-2", "31", "2021"]) == False assert is_valid_month(["March", "31", "2021"]) == False assert is_valid_day (["02", "33", "2000"]) == False assert is_valid_day (["02", "31", "2021"]) == False assert is_valid_day (["02", "1st", "2021"]) == False assert is_valid_day(["14", "1st", "2021"]) == False assert is_valid_year (["10", "15", assert is_valid_year (["12", "31", "-21"]) == False "22"]) == False
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Returning value from Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education