Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python Instructions Create a calendar program that allows the user to enter a day, month, and year in three separate variables as shown below.

In Python

Instructions

Create a calendar program that allows the user to enter a day, month, and year in three separate variables as shown below.

Please enter a date Day: Month: Year: 

Then, ask the user to select from a menu of choices using this formatting:

Menu: 1) Calculate the number of days in the given month. 2) Calculate the number of days left in the given year.

The program must include the following functions:

  • leap_year: Takes the year as a parameter and returns 1 if a year is a leap year (Links to an external site.) and 0 if it is not. This information will only be used by other functions.
  • number_of_days: This subprogram will accept two parameters in the following order: month and year. It will return how many days are in the given month (Links to an external site.).
  • days_left: This will accept three parameters in the following order: day, month, and year. It should calculate the number of days left in the year, and return the value of number of days left. This should not include the date the user entered in the count.

Note: Make sure to name the functions and pass the parameters exactly in the order specified.

Sample Run 1

Please enter a date Day: 5 Month: 5 Year: 1984 Menu: 1) Calculate the number of day in the given month. 2) Calculate the number of days left in the given year. 1 31

Sample Output 1

Please enter a date Menu: 1) Calculate the number of day in the given month. 2) Calculate the number of days left in the given year. 31

Sample Run 2

Please enter a date Day: 21 Month: 6 Year: 2016 Menu: 1) Calculate the number of day in the given month. 2) Calculate the number of days left in the given year. 2 193

Sample Output 2

Please enter a date Menu: 1) Calculate the number of day in the given month. 2) Calculate the number of days left in the given year. 193

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

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions