Question: Write and test the following function: def date _ extraction ( date _ number _ format ) : - - - -

Write and test the following function:
def date_extraction(date_number_format):
"""
-------------------------------------------------------
Extracts the year, month, and day from a date number in the format MMDDYYYY.
Use: year, month, day = date_extraction(date_number_format)
-------------------------------------------------------
Parameters:
date_number_format - a date number in the format MMDDYYYY (int >0)
Returns:
year - year portion of date_number (int)
month - month portion of date_number (int)
day - day portion of date_number (int)
------------------------------------------------------
"""
Add the function to a PyDev module named functions.py. Test it from .
This is a rewrite of Assignment 2, Task 3, 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: 10251962
date_extraction(10251962)->1962,10,25

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!