Introduction
we will do our due diligence to verify that the
provided date_list does indeed contain a proper
date. Note: we are using the US format for
strings: <MM>/<DD>/<YEAR>. For
example, 01/02/2022 can be represented as ['01',
'02', '2022'], which represents January 2nd, 2022.
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
Make sure that the input is of the correct type
Now, test the edge cases of the values:
Introduction we will do our due diligence to verify that the provided date_list does indeed contain a proper date. Note:
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am