For this assignment, you will create a calendar program that allows the user
to enter a day, month, and year in three separate variables as shown below.
Day:
Month:
Year:
Then, your program should 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.

I would really appreciate it if someone could help me on this.

For This Assignment, You Will Create A Calendar Program That Allows The Userto Enter A Day, Month, And

Answers

Answer 1

Following are the program to the given question:

Program Explanation:

Defining three methods "leap_year, number_of_days, and days_left " is declared. In the "leap_year" method, it accepts the year variable, which calculates the year is the leap year and returns its value that is 1. In the next method "number_of_days", it is define which accepts the "year and month" variable in the parameter and calculate and returns its value. In the last "days_left" method, it calculates the left days and returns its value, and outside the method, two dictionary variable days_31 and days_30 is declared.  It initilized a value by using 3 input variable "day, month, and year" variable which accepts user-input value. In the next step, a "c" variable is declared, that input values and calls and print its value accordingly.

Program:

def leap_year(y):#defining a method leap_year that takes one parameter

   l= 0#defining l variable that holds an integer

   if y % 4 == 0:#using if block that check year value module by 4 equal to 0

       l = 1#holding value in l variable

   if y % 100 == 0:#using if block that check year value module by 100 equal to 0

       l = 0#holding value in l variable

       if y % 400 == 0:#using if block that check year value module by 400 equal to 0

           l= 1#holding value in l variable

   return l#return l value

def number_of_days(m, y):#defining a method number_of_days that takes two parameters

   months = {1: 31, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}#defining months variable that hold value in ictionary

   l = leap_year(y)#defining l variable that calls leap_year method and holds its value

   if l == 1 and m == 2:#use if that check l value equal to 1 and 2

       return 29#return value 29

   if m == 2:#use if that check month value equal to 2

       return 28#return value 29

   return months[m]#return months value

def days_left(d, m, y):#defining a method days_left that takes three variable in parameter

   l = leap_year(y)#defining l variable that hold leap_year method value

   days = 0#defining days variable that hold integer value

   months = {1: 31, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31}#defining months variable that hold value in ictionary

   if l== 1:#using if that check l equal to 1

       if m > 2:#defining if that check m value greater than 2

           days += (29 + 31)#using days variable that Calculate holds its value

           i = m#defining i variable that holds months value

           while i > 2:#defining while loop that checks other days

               days += months[i]#defining a days variable that holds months value

               i -= 1#decreasing i value

           days -= (months[m] - d)#defining days that subtracts leap value

       elif m == 2:#defining elif block that checks m equal to 2

           days += (29 - d) + 31#holding value in days variable

       else:#defining else block

           days = 31 - d#Calculating days value

       return 366 - days#using return keyword that Calculates days value

   else:#defining else block

       if m > 2:#using if that checks m value greater than 2

           days += (28 + 31)#Calculating and store value in days

           i = m#holding months value in i

           while i > 2:#defining while loop that checks i value greater than 2

               days += months[i]#holding list value in days

               i -= 1#decreasing i value

           days -= (months[m] - d)#defining days that subtracts leap value

       elif m == 2:#using elif block that checks m value equal to 2

           days += (28 - d) + 31#Calculating and store value in days

       else:#defining else block

           days = 31 - d##Calculating and store value in days

       return 365 - days#return total days

print("Please enter a date")#print message

day = int(input("Day: "))#input value

month = int(input("Month: "))#input value

year = int(input("Year: "))#input value

print("Menu: ")#print message

print("1) Calculate the number of days in the given month.")#print message

print("2) Calculate the number of days left in the given year.")#print message

c = int(input())#input value

if c == 1:#using if that checks c value equal to 1

   print(number_of_days(month, year))#calling method and print its return value

elif c == 2:#using if that checks c value equal to 2

   print(days_left(day, month, year))#calling method and print its return value

Output:

Please find the attached file.

Learn more:

brainly.com/question/16728668


Related Questions

19 POINTS! (Excel) Use the drop-down menus to complete the steps for opening and using the Format Cells dialog box to change font and basic formatting.
1. Select the cell or range you want to format.

2. (1.Double click 2.single click 3. right click) the selection and click Format Cells to open the Format Cells dialog box.

3. Click the (1.format 2. font 3. cells) tab.

4. Apply the desired formats, and click OK.

Answers

Answer:

c 3

Explanation:

Answer:

Here

Explanation:

Number 1 Right-Click

Number 2 Font

Which of the following is an example of a tax?

cash payment,medicare,rental payment,line of credit

Answers

Medicare because it’s like insurance

Arrange the numbers 4, 8, 2, 6, 3, 5, 0, 1 into ascending order using the Merge sort algorithm

Answers

Answer:

1 2 3 4 5 6 you are missing seven the 8

Explanation:

Write a program that reads two integers, checks if a digit repeats 3 times in a row in the first integer and that same digit repeats two times in a row in the second integer.

Answers

Answer:

first_num = input("Enter integer digits (should be four or more digits): ")

sec_num = input("Enter integer digits (should be four or more digits): ")

num = '3'

if

def count_check( digit):

   if (digit * 3) in first_num and (digit * 2) in sec_num:

       print(True)

   else:

       print(False)

count_check(num)

Explanation:

The python source code above receives two values assigned to variables "first_num" and "sec_num" and defines a function called count_check to check if a digit occurs three consecutive times in the first input and two in the second to print a value of true or false otherwise.

What is another name for a numbered list

Answers

Answer:

Another name for a numbered list is a list

Kerri uses a photo editing program a lot. To increase her productivity, she should_____.


delete it from the Start menu

put it in her My Documents folder

move the program to the desktop

create a shortcut for it on Quick Launch

Answers

Answer:

Move the program to the desktop

Explanation:

It will be easier to access and quicker to open.

Write the line of code to calculate the area of a circle with radius 3 and store it in a variable called
area.

Answers

Answer:

area = 2.14 * 3 ** 2

Explanation:

No clue what language you use but this should be pretty universal. To find the area of a circle you use pi(r) ^ 2 or pi times radius squared

[tex]\pi r^{2}[/tex]

In python it looks like this:

>>> area = 3.14 * 3 ** 2

>>> print(area)

28.26 <Printed text

Guys im getting the ps5 tomorrow :)​

Answers

Answer:

Congrats.

Probably will be better than the Xbox minifridge

Question # 4
Multiple Choice
How do you stop a program that is stuck in an infinite loop?

Press the Alt key together with the Q key.

Press the Control key together with the C key.

Press the Control key together with the Q key.

Press the Alt key together with the C key.

Answers

Answer:Control +c

Explanation:yes

Answer: Press the Control key together with the C key.

Explanation: Correct on Edg 2020/2021.

What is used to give credit to the source from which information is obtained?
a citation
linkage
plagiarism
a format

Answers

a citation gives credit to the source

Answer:

a citation

Explanation:

How are online sources used? Check all that apply.

as a way to learn from others
as a way to play games
as a way to find information
as a way to socialize with others
as a way to copy the work of others

( and if not answer correctly I will report) · ⊃
·

Answers

Answer:

1 3 and 4

Explanation:

Answer:

as a way to learn from others

as a way to find information

as a way to socialize with others

Explanation:

, , ,g d,t ,dt m,dt ymtd

Answers

Answer:ummm me confused

Explanation:

Identify way computer are used in television production​

Answers

Answer:

image editing, text om screen, weather graphics, animation, sattelites ... a lot more possibilites are endless just limited

alexa it is olewi.............................................

Answers

Answer:

jvksvksdvkbvkjsdkcn

Explanation:

Huh.........whattttt

What number will be output by the console.log command on line 5?
A. 10
B. 11
C. 12
D. 13
E. 16

Answers

Answer:

E

Explanation:

If you follow the line of code and add 1, 2, and then 3, 10 + 1 + 2 + 3 = 16.

The output of the block of code will be 16 as the value of the variable is assigned a new value based on the number added to it on each line.

The initial value of the variable oop is 10

On the next line, 1 is added to oop and the resulting value is reassigned to the same variable, the new value of oop is 11

On the next line, 2 is added to oop and the resulting value is reassigned to oop, the new value of oop becomes 13

Variable oop is then increased by 3 ; making the value become (13 + 3) = 16

Therefore, the output of the command is 16.

Learn more :https://brainly.com/question/18505492

4.8 Code Practice: Question 2

Answers

Answer:

for y in range(88, 43, -4):

   print(y, end=" ")

Explanation;

yw

A file is transferred from one computer to another at the rate of 320 Kb/sec. How long would it take to complete the transfer if the file was 12.4 MB

Answers

Answer: 38.75 secs

Explanation:

Given data:

Size of the file been transferred = 12.4mb

Transfer speed = 320kb/secs.

Solution:

First we convert 12.4mb to kb.

= 12.4 * 1000

= 12,400kb.

We calculate for how long it would take to transfer the data

= 12400kb/320kb/s

= 38.75secs.

It would take 38.75 secs to transfer the data of 12.4mb.

What is the purpose of the introduction in an expository essay? A. to introduce the author and his or her dedication B. to highlight the main points of the essay C. to describe the supporting details D. to provide a figurative interpretation of the essay

Answers

I think it’s B, sorry if I’m wrong with this >

Choose a different well-known company that you know of, and describe its direct and indirect competitors. Describe at least 2 direct competitors and 2 indirect competitors.

Answers

nondirect competition is the variance between vendors whose products or services are not the same but that could gratify the consumer need
Lets take exampl of microsoft corporation
The indirect competitors are WHOLE FOODS and WAL-MART
Direct competitors sells the product or services that are same
the direct competitors are Apple, Google, HP, IBM
hope it helps

Answer:

Apple

Direct Competitors: Microsoft and Samsung

Indirect Competitors: Best Buy and Target

correct on edge

Select the correct answer.
Bella is moving the camera physically to the left to capture a fast-paced shot. Which technique is she using?
OA
pan left
OB.
truck left
O c.
truck right
OD.
zoom left
OE.
pan right

Answers

A ?
Because Bella is physicals moving the camera so I think it is A

How many categories should Jane use to track multiple levels of information learned through a student survey on teachers at her school? a. One category per teacher c. As many categories as she needs to understand the results b. Only one teacher per category d. None of these Please select the best answer from the choices provided A B C D

Answers

Answer:

c. As many categories as she needs to understand the results

Explanation:

In order to do this, she should track as many categories as she needs to understand the results. This is because Jane might need to understand various aspects of different teacher's performance during school hours. To do so she would need many different categories that apply to all of the teachers. That way when she gathers the results she can see which teachers perform best in a specific category when compared to the others, thus giving Jane a better understanding of each teacher's overall performance.

Answer:

i think its c because, In order to do this, she should track as many categories as she needs to understand the results. This is because Jane might need to understand various aspects of different teacher's performance during school hours. To do so she would need many different categories that apply to all of the teachers. That way when she gathers the results she can see which teachers perform best in a specific category when compared to the others, thus giving Jane a better understanding of each teacher's overall performance.

Explanation:

User can fill numbers in a column by using _______ command, ________ is a built-in formula in Excel to do calculations, Entering data into a cell means to _______ data into a cell, The MIN function displays the ________ value in a given list of values

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

This question is about fill-in-the-blank. The correct options in these fill-in-the-blanks are given below:

User can fill numbers in a column by using Down, Right, Up, Left, Series and Justify command

You can use these commands to fill numbers in columns. You can find these commands in the HOME tab under the Editing group of commands.

AutoSum is a built-in formula in Excel to do calculations

Autosum is a built-in formula that helps you to perform calculations, such as to calculate sum, average, and to find the minimum and maximum value. You can find the AutoSum command in the Home tab under the Editing group of commands.

Entering data into a cell means to put/insert data into a cell.

The MIN function displays the minimum value in a given list of values.

You use the MIN() function to display the minimum value in a given list of values or in the columns.

What is the advantage of using the Publish Online option for sharing a calendar? It creates a web version that can be viewed by anyone. It allows an employee's boss to see busy/free information. It allows a user inside an organization to view the calendar. It allows a user outside an organization to view the calendar.

Answers

Answer:

its D. it allows a user outside an organization to view the calendar.

Explanation:

i just got it right on edge 2020.

Answer:

B

Explanation:

I need the answer to life. I cant live without my POGCHAMPS!

Answers

Answer:

Pray to God and ask him for help in life. May God bless you

Explanation:

Answer:

Pog

Explanation:

Poggers

Which of the following is an example of a database?
A. the names and ages of children
B. the title of a book
C. a word that rhymes with bat
D. the name of the most recent U. S. president

Answers

A. The names and ages of children

Answer:

the names and ages of children

convert the decimal number 191 into an binary number

Answers

Answer:

Binary: 10111111

Explanation:

.
Why does the Moon have a greater effect on the tides compared to the Sun? (Select WILL GIVE BRANLEST PLS ASAP

two.)
The Moon is smaller than the Sun.
The Sun is closer to the Earth.
The Moon’s gravitational pull on the Earth’s oceans is stronger.
The Moon is closer to the Earth.
The Sun’s gravitational pull on the Earth’s oceans is stronger.

Answers

The correct option that explains the reason why the moon will have greater effect on the tides compared to the sun is;

Option D; The moon is closer to the Earth

Generally speaking, ocean tides on the earth are caused by both the gravity of the moon and the gravity of the sun.

Now, the mode of generation of ocean tides is not really by the total strength of gravity, but rather by the gravitational gradient.

Gravitational gradient is simply defined as the gravity differences from one spot to the other.

Now, from research, we know that the sun is far larger than the moon and this means in consequence it will have a far stronger total gravity than that of the moon. However, due to the fact that the moon is closer to the earth than the sun, it means the moon would possess a stronger gravitational gradient than which the sun possesses.

Now, let's get to ocean tides; The ocean tides arise as a result of the response of ocean water to a gravitational gradient and as a result, the moon will have a greater role in creating tides than that which the sun does.  

Read more at; https://brainly.com/question/24996618

can anyone help with this?​

Answers

The correct answer is Use hanging indents in the second line

Explanation:

One of the recommendations in the works cited page like the one presented is to use hanging indents. This implies the second, third, etc. line of a citation should be indented, while the first line is not indented. This is required by the MLA (Modern Language Association) because it makes citation to be easy to read. According to this, to improve the sample, hanging indents need to be included in the second line of the first and third citation.

Identify 5 way computer are used in weather forecasting an traffic control​

Answers

Answer:

Computers are used for interpolating data, and analyzing very complicated data.

Explanation:

In forecasting we need to look at a lot of weather variables (temperature, dew point, pressure and wind speed to name a few). We only collect this data from weather observation sites which can be tens to hundreds of kilometers apart. In order to determine these values at locations between the observation sites we interpolate.

When you are forecasting you need look at a lot of data and determine what is going on to determine what is going to happen next. If humans did all the interpolating themselves for all the data they would never be able to issue the forecast in the time that is expected. Furthermore, now that we have very complicated values to analyze (vorticity for example) there is no way that a human can calculate the effect of all the various factors in play. A computer has to do it.

Computers are also required for using weather radar, and yes to a lesser extent satellite data.

Which statement is true about hacking?
Hacking is generally a positive practice to stop cyber crime.
Hackers do so for various reasons, including the challenge of it.
Hacking cannot be used in the process to help protect sensitive information.
Hackers are rarely successful when attempting to bypass security software.

Answers

Answer:

Hackers do so for various reasons, including the challenge of it

Explanation:

I would say it is this. Plz mark brainliest Thanks:)

Answer:

Hackers do so for various reasons, including the challenge of it

Explanation:

Other Questions
Show by calculation which process produces more energy per gram of material reacting write a story of do not count your chicken before they hatched What is an accurate statement about many of the first Africans to come to Louisiana?They came voluntarily.They were skilled laborers. They came in search of domestic work. They knew how to grow crops. Complete the following statement.24 ft = in. i was teaching english when she _____the classroom(enter) Hi there can you guys please help me write 2 paragraphs (4-6 sentences) about in article ("How Many Sets & Reps Should I Do? (Building the Correct Workout Plan)" (Links to an external site.) A store sells a hoodie for $45, the sales tax rate in this state is 8%. What is the total price with sales tax applied? 1. The circle C has centre (5,k), where k is a constant. The line y = 2x + 1 is tangent to C at pointA (3,7). Find the equation of C. What is an equation of the line that passes through the points (0, -2) and (-5, 4)?Put your answer in fully reduced form. Evaluate the expression Which of the following shows 2.736 correctly rounded to the tenths place?2.742.72.83 Determine if parallel, perpendicular, or neither showing how to find the slope4x-7y=107x+4y=1 Which amendment gave Congress the power to tax income? 4 Options - 16th, 17th, 18th, or 19th In order to make schemas that will appear in the Schema Library available in the XML Options dialog box, what file extension should a user give to schemas?--.xml--.xsl--.xslt--.xsd Need help with this pls No rush on this one:)The price of a shirt decreases by 13$. Which integer represents the decrease in the shirts price? which statement best describes the jewish experience under syrian rule What types of solid waste do you produce in your home ?what could be done to each type and what goes to the disposal site or dumpsite Select Four answers.2/121/42/86/124/163/12 When you bring something back to its original condition you have:o destroyed itO established itO returned itO restored it