Answered step by step
Verified Expert Solution
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 oneweeklater.py that uses the algorithm in the starter code from a previous inclass exercise the code is posted to Canvas as Starter Code in the form of a function named finddateoneweeklater that is called from the function main. The function main should prompt the user to enter values: a month and a day. The main function should call
finddateoneweeklater, sending the month and day as arguments. Then, finddateoneweeklater should use those values in the algorithm. You can code the print statement in finddateoneweeklater or return the new date to main and print there. Your program should be in this form:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started