Question: 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:
 Purpose: We organize code into functions so it can be reused

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!