Introduction we will do our due diligence to verify that the provided date_list does indeed contain a proper date. Note:

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Introduction we will do our due diligence to verify that the provided date_list does indeed contain a proper date. Note:

Post by answerhappygod »

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:
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply