Goals Project 2 Practice using loops and conditional structures Practice the use of strings Description A...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Goals Project 2 Practice using loops and conditional structures Practice the use of strings Description A close associate of yours is diligently working on a calendar project, a venture rich with both promise and complexity. During this meticulous process, they have encountered challenges in calculating exact dates, revealing hidden intricacies within the seemingly simple task. Recognizing your expertise in this area, they have reached out for assistance with the date calculator component. The following steps summarize the project tasks: 1. Task 0: program set up and add brief description comments in the header area. 2. Task 1 implementing successor (), predecessor () function 3. Task 2: implementing date_calculator () function. 4. Task 3: implementing schedule_dates () function Task 1: implementing successor(), predecessor() function. def successor (date): Parameters: date(String) The function returns the immediate successor of the given date in the form of string. def predecessor (date): Parameters: date(String) The function returns the immediate predecessor of the given date in the form of string. Description: Write functions that compute the immediate successor or predecessor of a given date. For example, if the user enters values that represent 8/23/2023 then successor () should display the day immediately after 8/23/2023, which is 8/24/2023; predecessor () should display the day immediately before 8/23/2023, which is 8/22/2023. If the user enters values that represent 8/31/2023 then successor () should indicate that the next day is 9/1/2023. And so on. Ensure that your functions work correctly for leap years, where there would be 29 days in February. The input date will be in string form with the format of Month/Day/Year. And the output should be in the exact same format as the input. Sample Output: >>> print (successor ("8/23/2023") ) 8/24/2023 >>> print (predecessor ("8/23/2023″)) 8/22/2023 Task 2: implementing date_calculator () function. def date_calculator (date, difference): Parameters: date(string), difference (int) The function returns the exact date of the original date adding the difference. Description: In this function, the value of the difference could be either positive or negative. If it's positive, you need to calculate the exact date of the given date adding the absolute value of difference. If negative, you need to calculate the exact date of the given date subtracting the absolute value of difference. It's recommended to write this function with loops and the functions in task 1. Sample Output: >>> print (date calculator ("8/23/2023", -30)) 7/24/2023 Task 3: implementing schedule_dates () function def schedule_dates (start_day, end_day, interval): Parameters:start_day (string), end_day (string), interval (int) Description: The function prints all the dates between the start_day and the end_day with the specified interval (This means that you should exclude the start and end dates). The value of interval is positive. For example, if the start_day equals to 8/23/2023, the end_day equals to 9/20/2023, and the interval equals to 7, then the function would first print 8/30/2023, then 9/6/2023, finally ends with 9/13/2023. Sample Output: >>> schedule dates ("8/23/2023", "9/20/2023”, 7) 8/30/2023 9/6/2023 9/13/2023 Goals Project 2 Practice using loops and conditional structures Practice the use of strings Description A close associate of yours is diligently working on a calendar project, a venture rich with both promise and complexity. During this meticulous process, they have encountered challenges in calculating exact dates, revealing hidden intricacies within the seemingly simple task. Recognizing your expertise in this area, they have reached out for assistance with the date calculator component. The following steps summarize the project tasks: 1. Task 0: program set up and add brief description comments in the header area. 2. Task 1 implementing successor (), predecessor () function 3. Task 2: implementing date_calculator () function. 4. Task 3: implementing schedule_dates () function Task 1: implementing successor(), predecessor() function. def successor (date): Parameters: date(String) The function returns the immediate successor of the given date in the form of string. def predecessor (date): Parameters: date(String) The function returns the immediate predecessor of the given date in the form of string. Description: Write functions that compute the immediate successor or predecessor of a given date. For example, if the user enters values that represent 8/23/2023 then successor () should display the day immediately after 8/23/2023, which is 8/24/2023; predecessor () should display the day immediately before 8/23/2023, which is 8/22/2023. If the user enters values that represent 8/31/2023 then successor () should indicate that the next day is 9/1/2023. And so on. Ensure that your functions work correctly for leap years, where there would be 29 days in February. The input date will be in string form with the format of Month/Day/Year. And the output should be in the exact same format as the input. Sample Output: >>> print (successor ("8/23/2023") ) 8/24/2023 >>> print (predecessor ("8/23/2023″)) 8/22/2023 Task 2: implementing date_calculator () function. def date_calculator (date, difference): Parameters: date(string), difference (int) The function returns the exact date of the original date adding the difference. Description: In this function, the value of the difference could be either positive or negative. If it's positive, you need to calculate the exact date of the given date adding the absolute value of difference. If negative, you need to calculate the exact date of the given date subtracting the absolute value of difference. It's recommended to write this function with loops and the functions in task 1. Sample Output: >>> print (date calculator ("8/23/2023", -30)) 7/24/2023 Task 3: implementing schedule_dates () function def schedule_dates (start_day, end_day, interval): Parameters:start_day (string), end_day (string), interval (int) Description: The function prints all the dates between the start_day and the end_day with the specified interval (This means that you should exclude the start and end dates). The value of interval is positive. For example, if the start_day equals to 8/23/2023, the end_day equals to 9/20/2023, and the interval equals to 7, then the function would first print 8/30/2023, then 9/6/2023, finally ends with 9/13/2023. Sample Output: >>> schedule dates ("8/23/2023", "9/20/2023”, 7) 8/30/2023 9/6/2023 9/13/2023
Expert Answer:
Answer rating: 100% (QA)
Program Plan Define functions calcAttendanceScore calcHomeworkScore calcMidtermScore calcFinalScore ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
In a game of pool, you are shooting the cue ball at the 8-ball at 20m/s. The cue ball weighs 0.17kg and the 8-ball weighs 0.16kg. Before the collision, the 8-ball is at rest. Determine the speed of...
-
Before you begin this assignment, be sure you have read the UMUC Family Clinic Case Study below and your Week 1 and Week2 syllabus readings, which discuss EHR functionality and Process...
-
Leadership skills can help you in all aspects of your career, from applying for jobs to seeking career advancement. One of the many soft skills that employers value, leadership often incorporates...
-
Your friend recently attended a local mail fraud trial. In your conversation about the case, she described the cross-examination of the expert witness as follows: After his counsels questioning was...
-
A uniform sphere of mass m and radius R rolls without slipping down an inclined plane set at an angle a to the horizontal. Find: (a) The magnitudes of the friction coefficient at which slipping is...
-
The United States has increased the National Debt due to wars, recessions, and most recently, a global pandemic. As of 10-4-22, the National Debt is now over $31 Trillion. Does the Government Debt...
-
Consider the air pollution and mortality data given in Table B.15. a. Is there a problem with collinearity? Discuss how you arrived at this decision. b. Perform a ridge trace on these data. c. Select...
-
The partners in Tallis Company decide to liquidate the firm when the balance sheet shows the following. The partners share income and loss 5 : 3 : 2. During the process of liquidation, the...
-
PLAN FOR A SOCIAL BUSINESS The company and especially its top management are the brand. The objective of your social business campaign is to externally promote brand mission imagery and build brand...
-
A DC motor and a speed reducer transmission needs to be designed to power a hip joint of a robot as shown below. You are asked to choose the right DC motor for this robot to support the motion of the...
-
What is gout? What are the features?
-
Why did Judge Lynch conclude that the sentence he was required to impose on "Eddie" was "unjust"? Do you agree or disagree with his conclusion?
-
What problems do each of the philosophical perspectives on sentencing-retribution, deterrence, incapacitation, rehabilitation-encounter in attempting to determine "how much to punish"?
-
According to retributive theory, why do those who violate the law deserve to be punished?
-
What are the "key determinants" of judges' sentencing decisions? Why are these two factors so important?
-
If the $\mathrm{AC}$ line is lower than the $\mathrm{EV}$ line on a cost variance graph, would that indicate a favorable or unfavorable variance?
-
5) A stem-and-leaf diagram is given below for the annual precipitation in inches for one city for the last 32 years. Key 412=42 27 3 14 4 32 a) Is this distribution left skewed, right skewed or...
-
United Business Forms capital structure is as follows: Debt ............................................ 35% Preferred stock ........................... 15 Common equity .......................... 50...
-
a. What type of information asymmetry is present in this case and how could BHIC decrease its effects? b. Assuming a semi-strong form efficient market, why do you believe the share price fell on the...
-
There are a variety of rankings for educational institutions and programs around the world. Among them are university rankings by Times Higher Education (www.timeshighereducation.co.uk) and Academic...
-
Refer to the information in problem P6-22. Assume that the company uses a periodic inventory system and counts inventory at the end of each month. Data from P6-22. Required: Using the...
-
Identical positively charged objects \(A, B\), and \(C\) are launched with the same initial speed from the same position above a negatively charged sheet that produces a uniform electric field. The...
-
A proton, a deuteron (a hydrogen nucleus containing one proton and one neutron), and an alpha particle (a helium nucleus consisting of two protons and two neutrons) initially at rest are all...
-
What orientation of an electric dipole in a uniform electric field has the greatest electric potential energy? What orientation has the least? (Let the system comprise both the electric dipole and...
Study smarter with the SolutionInn App