Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose: We organize code into functions so it can be reused in other programs. One program may interact with a human user for input while

Purpose:
We organize code into functions so it can be reused in other programs. One program may interact with a human user for input while another program may be getting its input from a website. Input should be separate from processing.
So a good skill to have is the ability to reorganize a program so it uses functions to do its work. The purpose of this assignment is gain skills in refactoring code. In this case, refactoring means taking existing code and reorganizing it to have a better structure. That is, the refactoring we do here is to separate code that should be in a reusable function from the code that should use the function.
Requirements:
Write a Python program named one_week_later.py that uses the algorithm in the starter code from a previous in-class exercise (the code is posted to Canvas as Starter Code) in the form of a function named find_date_one_week_later that is called from the function main. The function main should prompt the user to enter 2 values: a month and a day. The main function should call
find_date_one_week_later, sending the month and day as arguments. Then, find_date_one_week_later should use those values in the algorithm. You can code the print statement in find_date_one_week_later or return the new date to main and print there. Your program should be in this form:
image text in transcribed

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

Determine the distribution function of min0yt X(y).

Answered: 1 week ago