Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions