Write a function convert_date that takes an integer as a parameter and returns three integer values...

70.2K

Verified Solution

Question

Programming

  1. Write a function convert_date that takes an integer as aparameter and returns three integer values representing the inputconverted into days, month and year (see the functiondocstring).

Write a program namedt03.py that tests the function byasking the user to enter a number and displaying the output day,month and year. Save the function in a PyDev library module namedfunctions.py

A sample run for t03.py:

Enter a date in the format MMDDYYYY:05272017

The output will be:

27/05/2017

The function docstring is asfollows:

def convert_date(date_int): \"\"\"

-------------------------------------------------------

Converts date_intinto days, month and year use: day,month,year = convert_date(date_int)

-------------------------------------------------------

Paramaters:

date_int – (int > 0)

returns

day: the day in the month in date_int(int >= 0)

month: the monthin date_int (int >=0) year: the years in date_int (int>=0)

------------------------------------------------------- \"\"\"

  • Test your program with 2 different date values than those givenin the example.
  • You may assume that the user will only enter numbers (2 digitsfor month, 2 digits for days and 4 digits for year)
  • You are not allowed to use any string methods or stringindexing.
  • Copy the results to testing.txt.

Answer & Explanation Solved by verified expert
4.4 Ratings (700 Votes)
Program CodeScreenshotSampleoutputThe screenshots are attached below for referencePlease follow them for proper indentation and outputProgram tocopydef convertdate    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students