Question
PYTHON Write a program that prompts the user to enter a year, month, and day, and computes its immediate successor. For example: if the user
PYTHON
Write a program that prompts the user to enter a year, month, and day, and computes its immediate successor. For example:
if the user enters September 19, 2018, your program should print out September 20, 2018.
if the user enters September 30, 2018, your program should print out October 1, 2018.
if the user enters December 31, 2018, your program should print out January 1, 2019.
Input:
Your program should ask the user for the year (an integer), the month (a string), and the day (an integer), in that order.
Your program does not need to validate the input; that is, you can assume that the user has entered valid values for the year, month, and day.
Your program DOES need to check for leap years! If the user enters a date of February 28 and the year is a leap year, the next day should be February 29. If the year is not a leap year, the next day is March 1. Use the code in section 4.12 of the textbook to help you determine if a year is a leap year.
Expected output:
Format your output so that, if the user were to enter September 19, 2018, your output would look exactly like the following:
Please enter the year: 2018 Please enter the month: September Please enter the day: 19 The next day is September 20, 2018.
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