Question: Write and test the following function: def date _ extraction ( date _ number _ format ) : - - - -
Write and test the following function:
def dateextractiondatenumberformat:
Extracts the year, month, and day from a date number in the format MMDDYYYY
Use: year, month, day dateextractiondatenumberformat
Parameters:
datenumberformat a date number in the format MMDDYYYY int
Returns:
year year portion of datenumber int
month month portion of datenumber int
day day portion of datenumber int
Add the function to a PyDev module named functions.py Test it from
This is a rewrite of Assignment Task as a function.
The function must use integer division and modulus, not strings, to extract the date parts. The function does not ask for input and does no printing that is done by your test program.
Sample testing:
Enter a date in the format MMDDYYYY:
dateextraction
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
