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

Which of these are reasons to evacuate a building during an earthquake? Mark all that apply.
A. There is a water leak.
B. The building is on fire.
C. There is structural damage to the building like newly cracked walls.
D. There is a gas leak.

Answers

Answer:

D

Explanation:

Answer:

c, b

Explanation:

I am guessing those are correct I don't really know

True or False? You should never move an injured person.
True
False

Answers

Answer:

true

Explanation:

what is the depth of the following tree?

Answers

Answer:

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

Explanation:

This given tree has four nodes. Node A is a parent node in this tree, while B, C, and D are child nodes of A.

The given options about the depth of the tree are:

A). 0B). 1C). 2D). 3

The correct option to this question is (B) i.e. the depth of this tree is 1.

Because we know that the depth of a node M in the tree is the length of the path from the root of the tree to M. So, in this case,  the depth of node A to node B, C, and D  is 1. So, the correct option to this question is B. i.e the depth of the given tree is 1.

Write a for loop in python that prints 10 random numbers between 1 and 100 inclusive.

Answers

import random

for x in range(10):

   print(random.randint(1,100))

What is a characteristic of tasks in Outlook?
The Tasks view can be seen by clicking the View tab.

New tasks are created in the Appointments form

Tasks are an action item in Outlook and are basically a to-do list.

Old tasks are automatically deleted from your list​

Answers

Answer:

C. Tasks are an action item in Outlook and are basically a to-do list.

Explanation:

A to-do List is just a list of tasks.

and I took the test and got it right

Answer:

C. is correct

Explanation:

edg 2021

Which of the following is true about overloaded methods?

Answers

Answer:

Overloaded must have the same name but different parameter lists.

Explanation:

Given that in certain programming languages such as Java, the overload method is a means by which a specific word or symbol has more than one meaning or function, that Is, different parameters or executions but have the same name.

Hence, in this case, what is true about overloaded methods is that "Overloaded must have the same name but different parameter lists."

You wrote a program to find the factorial of a number. In mathematics, the factorial operation is used for positive integers and zero. What does the function return if the user enters a negative three? def factorial(number): product = 1 while number > 0: product = product * number number = number - 1 return product strNum = input("Enter a positive integer: ") num = int(strNum) print(factorial(num))
-6
1
-3
There is no output due to a runtime error.

Answers

Answer: well it’s not “There is no output due to a runtime error”

Explanation: Put that and I got it wrong

The Answer Is 1.

Edge 2020.

Given the formula on the left, label the parts. SUM . A2:D19 . E55 . (A2:A19,C13,E55,19) .

Answers

Answer:

SUM  

✔ function name

.

A2:D19  

✔ range

.

E55  

✔ value

.

(A2:A19,C13,E55,19)  

✔ argument

Answer:

1. B

2. A

3. A

4. C

Explanation:

On edge2020 I got it right

Myra just got the latest computer game and wants to play it on her desktop. When she plays the game, she notices that it is sluggish and the animations are not very clear. What can she do to improve her gaming experience?

Answers

Answer:

Ram/cpu/gpu... Many many things she can do

Explanation:

It may be a issue of internet bandwith, if this new game requires a insane ammount of internet then it may run low FPS (frames per second) and make myra's game look slughish,but anouther issue may be the ram or cpu, like if this is a new game and you've always played like simple games, so your running on persay a core i3 or i4, it aint gonna cut it on a newer game, you gonna need a probably core i5 or i7, or be like any sane person and switch to amd, it may be a bit pricy but if you want nice clean gaming, then amd is the way to go

Also while you are at it get a ssd

I hope this helps "-"

Answer:

She can upgrade her hardware/software

Explanation:

For hardware, she can troubleshoot any broken components that are possibly in the computer, upgrade cards/fans, etc.

and for software she can upgrade her operating system, upgrade or download any missing frameworks, clear out any software that is taking too much CPU/RAM in the background using task manager/system viewer/KSysGuard, etc.

What is the
binary code
for
"DMS"?

Answers

Answer:

D= 01000100

M= 01101101

S= 01110011

Explanation:

JAVA
Write a program that requests the user input a word, then prints every other letter of the word starting with the first letter.
Hint - you will need to use the substring method inside a loop to get at every other character in the String. You can use the length method on the String
to work out when this loop should end.
Sample run:
Input a word:
domain
dmi

Answers

import java.util.Scanner;

public class JavaApplication42 {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Input a word:");

       String word = scan.nextLine();

       for (int i = 0; i < word.length(); i+=2){

           System.out.print(word.substring(i,i+1));

           

       }

   }

   

}

I hope this helps!

The program is an illustration of loops.

Loops are used to carry out repetition operations; examples are the for-loop and the while-loop.

The program in Java, where comments are used to explain each line is as follows:

import java.util.*;

public class Main {

public static void main(String args[]) {

//This creates a Scanner object

Scanner input = new Scanner(System.in);

//This prompts user for input

System.out.print("Input a word: ");

//This gets input from the user

String userinput = input.nextLine();

//The following iterates through every other character of userinput  

      for(int i =0;i<userinput.length();i+=2) {

//This prints every other characters

          System.out.print(userinput.charAt(i));

}

  }

}

The above program is implemented using a for loop

Read more about similar programs at:

https://brainly.com/question/19104397

At the start of the school year, Brianna’s history teacher announces that students’ final grades will be weighted based on how they do in three categories: exams (60 percent), final presentation (30 percent), and class participation (10 percent). Which strategy would most likely help Brianna get the best grade? spending more time studying for exams than creating the final presentation splitting her time evenly between studying for exams and creating the final presentation concentrating on creating the final presentation and speaking up in class working hard at participating in class and studying for exams

Answers

Answer:

it is A

Explanation:

did on edge test

Answer:

A

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

to develop vocabulary, a student should increase their

a) use of expression

b) use of punctuation

c) oral reading rate

d) familiarity with sight words

Answers

A because you can decrease the rest and none would make sense. I learned 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

Can you guys list all the Linux Debian Apps that can only be installed on a Linux terminal command line, I have a deb 32 bit

Answers

Answer:

Two of those are apt and apt get and the other one is dpkg. 4. You will see a list of Debian Ensure package lists and installed packages are up to date. ... Apt may fail to remove old Linux kernels when using an Ubuntu version that 39 s ... To install it just enter the following command from the Terminal sudo apt install apt ...

Explanation:

Laptop computers use PCMCIA cards, another type of ________

a.
USB drive
b.
mass storage
c.
smart cards
d.
flash memory

Answers

Answer:

mass storage or flash memory

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

In which area of the screen can features and functions of Word be accessed?

Command
Ribbon
Scroll bar
Tab

Please Hurry!!!

Answers

Answer:

Toolbar

Explanation:

j don't know if you meant that instead of scroll bar, but tool bar is the answer

Answer:

scroll bar

Explanation:

Instructions
Write a program that will add up the series of numbers: 99, 98, 97… 3, 2, 1. The program should print the running total as well as the total at the end. The program should use one for loop, the range() function and one print() command.

Sample Run
99

197

294

390







4940

4944

4947

4949

4950

Answers

total = 0

for x in range(99, 0, -1):

   total += x

   print(total)

I hope this helps!

Select the correct answer.
Adrian is organizing a training lecture for his students in various states simultaneously through radio, TV, and the Internet. What is this event
known as?

A. webcast

B. simulcast

C. broadband

D. online lecture

Answers

Answer:

a

Explanation:

a webcast is the answer I think

In an inequality between two numbers, -2.1 is located below the other number on a vertical number line. So, the other number is -2.1. One possible value of the other number is .

Answers

Answer:

-2.0

Explanation:

Given

Number = -2.1

Required

Determine the other number

From the question, we understand that the number is represented on a vertical number.

From bottom to top, numbers on a vertical number line increases.

Since the other number is at the top of -2.1, then we can conclude that this number is greater than-2.1

Hence, possible values are ,-2.0, -1.9, etc.

Answer:

First blank: greater than.

Second bank: -1.5

Explanation:

What is the value of the variable moneyDue after these lines of code are executed?

>>> numSodas = 2
>>> costSodas = 1.50
>>> moneyDue = numSodas * costSodas

Answers

Answer:

3.0

Explanation:

To understand why there is a blank decimal, we have to understand that when you add multiply or subtract with a float (in python), the result will also be a decimal, even you use a blank decimal in the equation. A circumstance where the output would just plain 3, you would have to put in the following:

>>>int(moneyDue)

To insure it will output an int. However, it does not use that line of code, thus proving the answer is 3.0.

hope this helped :D

Answer:

3.0

Explanation:

edge

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:

Analyze the map below and answer the question that follows. A topographic map of Northwestern Russia. Areas on the map are circled and labeled 1, 2, 3, and 4. 1 is a mountain range. 2 is a flat area. 3 is a highland area. 4 is a plateau. Image by Natural Earth The region labeled with the number 1 on the map above is the __________.

Answers

Answer:region 1

Explanation:

Answer:

region 1

Explanation:

correct on edg 2020

Keith has data in row 12. However, he would actually like that row to be empty. Keith should _____. A.) double-click on cell A12 and press Backspace B.) highlight row 12 and press Delete C.) use the arrow keys to move to row 12 and press Enter or Return D.) use the mouse to click row 12 and press the space bar

Answers

Answer:

B.)

Explanation:

In order to have that row, empty Keith should highlight row 12 and press Delete. This would delete all of the data in the row without effectively deleting the formulas. Therefore, allowing you to easily reuse the row if you need to add data to it once again. So this would be the best option for Keith as it easily solves the problem that he is having.

Which of the following allows a user to quickly access a frequently used computer app? Alphabetize program icons. O Create a shortcut on the toolbar. O Delete all icons on the screen. Place all icons in one folder.​

Answers

Answer:

Create a shortcut on the toolbar

Explanation:

You can use process of elimination. alphabetizing would not help to find it quicker, but it is an easier way. Deleting all icons wouldn't help at all. And placing all icons in a folder would make it even messier. So, it is creating a shortcut. Plus, I got it right on my test :)

Answer:

its a shortcut

Explanation:

took da test and got 100

Use of the Internet for e-government has increased. Identify the benefits by checking all of the boxes that apply.
A. It keeps the public informed about events
B. People do not have to vote
C. People can pay bills
D. People do not have to visit the site
E. The government can share important information about issues with the people in that town.

Answers

It’s A my good guy have a great day

Answer:

the answer is A C and E

Explanation:

CALCULATE THE PERCENTAGE OF FAT CALORIES TO TOTAL CALORIES. I got no idea how to do this in excel ;-;

Answers

Answer:

As you have the Fat Cal. in column C and the total calories in Column B, what you have to do is to divide column C by Column B.

For instance, in column E2, put the formula: =C2/B2.

Then drag the formula down so that the other formulas will be;

E3; =C3/B3

E4; =C4/B4

E5: C5/B5

E6: C6/B6

Then after that you go to the Home tab, then to the Number style section and format E2 to E5 to be percentages.

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

Other Questions
Please help please help The Conneticut Compromise provided A. The BIll of RightsB. For the popular vote for the presidentC. for a one-house legislatureD. for two legislative houses Read this thesis statement.The gray whales' annual journey from the frigid waters of the northern Pacific to the warm lagoons near Baja California, Mexico, is one of the most remarkable migrations of any species on the planet.Which piece of information, gathered from research, best supports this thesis statement?The gray whale is a baleen whale that measures 40 to 50 feet and can weigh between 30 and 40 tons.Gray whales use a comb-like strainer in their upper jaw to filter the food they forage off the seafloor.Traveling in pods, or groups, the gray whales' round-trip from Alaska to Mexico covers about 12,430 miles.Once close to extinction from extensive hunting, gray whales are now protected by international law. Question 2 of 9Corn seeds were germinated (grew and put out shoots after a period of dormancy) in a dark roomplaced in the light, 75 of these seedlings turned green. Which conclusion about chlorophyll (theplants can most reasonably be drawn from this information?(1 point)DA. Light is the only factor that controls the production of chlorophyll.B. Darkness is the only factor that prevents the production of chlorophyll.IC Light and vitamins are necessary for chlorophyll production.D. Light and some other factor are necessary for chlorophyll production.----Page 2 of 9---- Which statement best describes the New Kingdom's economy during the reign of Queen Hatshepsut?A)The economy of the New Kingdom suffered under Queen Hatshepsut.B)Egypt's economy prospered with increased trade and public works projects.C)Egyptians were taxed so heavily that they lived in poverty.D)Egyptians had no natural resources to trade with neighboring societies.PLEASE ANSWER FAST I NEED HELP PLEASE HELP ILL GIVE BRAINLIEST What is the main citation style for English and humanities classes? Modern Language Association style (MLA) American Psychological Association style (APA) .edu style (EDU) .gov style (GOV) Matt has started a car washing business to save money for college. Each week, hewashes 3 more cars than he did the week before. What should happen to food right after it is thawed in the microwave oven. A) hold it in equipment that maintains the correct temperature B) Cook it in our conventional cooking equipment C) cool it to 41 degrees D) freeze it solid x + 2x + 12y + 4 Using the expression shown, add like terms and produce an equivalent expression. Identify the range of the function shown in the graph.10+884-10 -8 184-B-10 What is the value of the expression?- 16+ 120-28-44O 28 Directions: Answer the following asked in the problem by finding the quotient.1. Tina and Titoy went to the market to buy 5.75 kilos of ground meat. When they came home,they divided the whole meat into one-tenths and put it in plastic bags for future use. Howmany bags of meat were there?If you were Tina and Vicky, will you divide it again into one-hundredths? If yes, how manybags of meat doyouthinkyou can make? Find the slope of the line that passes through (9, 10) and (5, 19).Simplify your answer and write it as a proper fraction, improper fraction, or integer.Submit Add, subtract, multiply, or divide. Can someone help me please. Help! Question on khan academy! pls explain I need help With this please What is 13.48cm+7.6cm rounded to the correct number of significant figures? Who or what would be considered a reliable primary source on the subject of directing a Hollywood movie?a.a textbook on directingb.director Steven Spielburgc.the Internetd.a college student studying film makingPlease select the best answer from the choices providedABCDI'm being timed! do soda taxes improve public health