edhesive assignment 7 calendar

Answers

Answer 1

Answer:

def leap_year(y):

 if y % 4 == 0:

     return 1

 else:

     return 0

def number_of_days(m,y):

 if m == 2:

     return 28 + leap_year(y)

 elif m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m ==10 or m == 12:

     return 31

 elif m == 4 or m == 6 or m == 9 or m == 11:

     return 30

def days(m,d):

 if m == 1:

     return 0 + d

 if m == 2:

     return 31 + d

 if m == 3:

     return 59 + d

 if m == 4:

     return 90 + d

 if m == 5:

     return 120 + d

 if m == 6:

     return 151 + d

 if m == 7:

     return 181 + d

 if m == 8:

     return 212 + d

 if m == 9:

     return 243 + d

 if m == 10:

     return 273 + d

 if m == 11:

     return 304 + d

 if m == 12:

     return 334 + d

def days_left(d,m,y):

 if days(m,d) <= 60:

     return 365 - days(m,d) + leap_year(y)

 else:

     return 365 - days(m,d)

print("Please enter a date")

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

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

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

choice=int(input("Menu:\n1) Calculate the number of days in the given month.\n2) Calculate the number of days left in the given year.\n"))

if choice == 1:

 print(number_of_days(month, year))

if choice == 2:

 print(days_left(day,month,year))

Explanation:

Hoped this helped

Answer 2

The program is an illustration of functions.

Functions are groups of code segments that are executed when called or evoked

The calendar program

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

#This checks for leap year

def leap_year(y):

   if y % 4 == 0:

       return 1

   else:

       return 0

#This returns the number of days in the month

def number_of_days(m,y):

   if m == 2:

       return 28 + leap_year(y)

   elif m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m ==10 or m == 12:

       return 31

   elif m == 4 or m == 6 or m == 9 or m == 11:

       return 30

#This returns the number of days left in the month

def days(m,d):

   dayList = [0,31,59,90,120,151,181,212,243,273,304,334]

   return dayList[m-1] + d

#This returns the number of days left in the year

def days_left(d,m,y):

   if days(m,d) <= 60:

       return 365 - days(m,d) + leap_year(y)

   else:

       return 365 - days(m,d)

#The main begins here

#This next three lines gets input for date

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

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

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

#This gets the choice from the user

menu=int(input("Press 1 to calculate the number of days in the given month.\nPress 2 to calculate the number of days left in the given year.\nChoice: "))

#This prints the number of days in the month

if menu == 1:

   print(number_of_days(month, year))

#This prints the number of days left in the year

elif menu == 2:

   print(days_left(day,month,year))

Read more about Python functions at:

https://brainly.com/question/14284563


Related Questions

What is web
searching engine ?​

Answers

A Web search engine is a specialized computer server that searches for information on the Web. The search results of a user query are often returned as a list. The hits may consist of web pages, images, and other types of files.


what is
Force (N) = Mass (kg) x acceleration (m/s)

If a 80-kg swimmer pushes off a pool wall with a force of 225 N, at what rate with the swimmer

accelerate forward?​

Answers

Hope this really helps u with your studies
225/80=2.8125m/s

How is a digital representation of analog data a form of abstraction? Why is the quality of the photo, music, etc better when more samples are taken? Music is an example of analog data. What other examples of analog data can you think of?

Answers

Answer:

1. This is because non-essential parts of the analog data is cut of so as to represent the analog data digitally.

2. This is because it mirrors closely to the original analog material.

3. i. Temperature ii. Speed ii. Distance iv. Electric current

Explanation:

1. How is a digital representation of analog data a form of abstraction?

Digital representation of analog data is a form of abstraction because, since abstraction, which is the removal of non-essential parts of a material so as to reduce complexity, also non-essential parts of the analog data is cut of so as to represent the analog data digitally.

2.Why is the quality of the photo, music, etc better when more samples are taken?

The quality of these items is better because, as more samples are taken, it reduces the error in the sampling and the item(photo, music etc) mirrors closely to the original analog material.

3. What other examples of analog data can you think of?

i. Temperature ii. Speed ii. Distance iv. Electric current

Why is it a good practice to use functions in programming? Select the best answer.

A.It is faster to run the code using functions.

B.Functions allow us to reuse common code.

C.All of these are correct.

D.It is easier to debug the code using functions.

Answers

Answer:

C. All of these are correct answer from the options for the question that u have given...

The good practice to use functions in programming is all of these are correct. The correct option is C.

What are functions in programming?

The repetitious codes are removed by breaking a program down into functions, which not only reduces the size of the program but also improves its effectiveness. If there were repetitive codes, we would need to alter the program from several locations rather than just one.

As a result, organizing programs into functions aid in good administration and shortens programs by removing repeated code. A functional programming language is a particular kind of language that allows for the creation and application of pure mathematical functions, along with the use of conditional expressions and recursion to carry out various computations.

Therefore, the correct option is C. All of these are correct.

To learn more about functions in programming, refer to the link:

https://brainly.com/question/24297344

#SPJ6

Identify one audience for The Sun Website

Answers

Answer:

69

Explanation:

A beam of light travels in air and then passes through a piece of glass at an angle of 45 degrees to the normal. As the light passes from the air into the piece of glass, the light ray is bent, what is the angle of refraction measured from the normal?

Answers

Answer:

The angle of refraction measured from the normal is approximately 28.13°

Explanation:

The angle of refraction is the angle made by the refracted ray and the normal line drawn at the point where the ray passes through the interface of the two mediums

According to Snell's law, we have;

[tex]_1 n_2 = \dfrac{n_1}{n_2} = \dfrac{sin \, \theta _2}{sin \, \theta _1}[/tex]

n₁·sin (θ₁) = n₂·sin(θ₂)

Where;

₁n₂ = The refractive index of air to glass = 1.5

n₁ = The refractive index of air = 1

n₂ = The refractive index of glass ≈ 1.5

θ₁ = The angle of incidence = 45°

θ₂ = The angle of refraction measured from the normal

Therefore, we have;

1/1.5 = sin(θ₂)/sin(45°)

sin(θ₂) = sin(45°)/1.5 = (√2)/2/(3/2) = (√2)/3

∴ θ₂ = arcsin((√2)/3) ≈ 28.13°

The angle of refraction measured from the normal = θ₂ ≈ 28.13°.

Write a program code to accept the names of 3 users and generate a user name as shown in the example. Accept the name of 3 user in the format – Firstname Last name (eg. Anan Gupta). Select the first 3 characters from the first name, add # and then add last 3 characters of the last name. Display the newly generated user name along with the names that were input.

Answers

Answer:

Explanation:

The following code is written in Python and is a function that loops three times asking for the last name and first name. Then it uses this information to create a username. Finally, each of the names and usernames is printed on the screen.

def userName():

   for x in range(3):

       last_name = input("What is your last name: ")

       first_name = input("What is your first name: ")

       username = first_name[:3] + "#" + last_name[-3:]

       print(last_name + ", " + first_name)

       print(username)

I really need help with this question, I can’t fail this please :) tysm

Answers

Answer:

i think its the third one, i hope this helps

Explanation:

True or False? Security code is almost always open source!
True
False

Answers

Answer:

its true

Step-by-step explanation:

Security code is almost always open source is a false statement. Check more about  Security code below.

What is security code?

The  Security code  is known to be the number that is known to be found in the front or back of any credit cards. It is made just  for security use.

Conclusively,  Security code is almost always open source as one cannot get it except one is told about it. Therefore, it is not an open source.

Learn more about  Security code from

https://brainly.com/question/26260220

Can someone please help me with this assignment on Edhesive. I just need the storyboard and code. thank you.

Answers

Answer:

i need points im so sorry

Explanation:

Boolean Operators help filter information when completing a ________ ________

A. web search
B. column making​

Answers

The answer would be A: Web Search :)

True or false: Machine learning lets computers
learn how to do things they weren't
specifically programmed to do.

Answers

Answer:

True

Explanation:

Which steps should you follow to show the Developer tab after clicking Options in the File tab?

Click Customize Ribbon, and check next to Developer in the Main Tabs area.
Click the Developer tab, click Switch View, and click OK in the Main Tabs area.
Click Open, and add a check mark next to Developer in the Customize area.
Click the View tab, add a check mark next to Developer, and click OK.

Answers

Answer:

A Click Customize Ribbon, and check next to Developer in the Main Tabs area.

Explanation:

Answer:

c

Explanation:

Someone please tell me what lambda does! in python!! I need help

Answers

Answer:Lambda Technologies is the he is the group name encompassing a Premier materials research laboratory with an engineering and production enterprise dedicated to the development and optimization of of surface treatments our company has been selling materials for over four decades with over 150 years of combined experience in more than 20,000 research programs we are proud of our corporate legacy in record or around standing performance in meeting or customers needs room training all excellence groundbreaking innovation and committed hard-working employees we are able to provide more than just data we provide complete service enhancement solutions are resources that can include all of our technical papers he studies defraction notes and downloads we are a well known source of research in education materials on the understanding measurement and controls of residual stress

Explanation:

Which are the following 4 things something must be able to do in order to be a computer? *

Answers

Answer:

There are four main equipment functions of a computer system: Input, Processing, Storage and Output.

Explanation:

why would computer programmers want to use an object to change the instructions they already created in a computer program ​

Answers

Answer:

bank rupt

Explanation:

no money on your card lol have  a graey day dont wish for what your not willing to work for

Which of the following is NOT an acceptable way to create a color?


A) O "cyan"
B) O "#ff2341"
C) blue
D) "RGB (0, 15, 234)"

Answers

The option that is not an acceptable way to create a color is blue.

How can I create a color?

There are a lot of ways to create  some unique color  such as the additions of  colors together.  An example is the addition of purple, orange, and green together.

Note that blue on its own cannot create another color and as such, The option that is not an acceptable way to create a color is blue.

Learn more about color from

https://brainly.com/question/4431200

#SPJ2

Write a C++ program to add two integers. Make a function add() to add integers and display sum in main() function.

Answers

Answer:

In C++:

#include <iostream>

using namespace std;

int add(int a, int b){

   int c = a + b;

   return c;

}

int main(){

   int a, b;

   cout<<"Enter two numbers: ";

   cin>>a;

   cin>>b;

   cout<<add(a,b);

   return 0;

}

Explanation:

The add() function begins here

int add(int a, int b){

This adds the two integers

   int c = a + b;

This returns the sum of the two integers

   return c;

}

The main begins here

int main(){

This declares two numbers

   int a, b;

This prompts user for two numbers

   cout<<"Enter two numbers: ";

The next two lines gets the two numbers

   cin>>a;

   cin>>b;

This gets the sum of the two numbers from the add() function. The sum is also printed

   cout<<add(a,b);

   return 0;

}

how do you do the ask tutor thing on the computer?

Answers

Answer:

what do you mean

Explanation:

Can someone help me figure out why my else statment is not working?




----------------------------------------------------------------------------------------------------------------------------
print("\tBank of The Funny Money Bunny Farm\n")
print("Client\t\tDeposits\tWithdrawals\tBalance\t\tNotes:")
print("__________________________________________________________________________________________________________________________")

names = ['Judith', 'Jimmie', 'Johnny', 'Joseph', 'Jeffry', 'Buddie', 'Charlie', 'Maxine', 'Jannis', 'Bodine']
deposists = [255.23, 525.55, 323.21, 651.48, 507.11, 101.11, 253.36, 323.22, 611.45, 252.91]
withdrawals = [255.76, 128.65, 156.22, 175.33, 390.12, 255.41, 128.22, 156.23, 728.98, 251.43]
balance = []
notes = []

for i in range(len(names)):
balance.appened(deposits[i] - withdrawals[i])
if(balance < 0):
print((names[i] + ", you are overdrawn. Your account balance is " + "$%.2f"%(balance[i]))
else:
print("" + names[i] + "\t\t" + "%.2f"%(deposits[i]) + "\t\t" + "%.2f"%(withdrawals[i]) + "\t\t" + "%.2f"%(balance[i]) + "\t\t" + notes[i])

print("__________________________________________________________________________________________________________________________")
print("\© Copyright 2021 Funny Bunny Money Productions")

#Main

print("\tBank of The Funny Money Bunny Farm\n")
account = int(input("How many new accounts are needed: "))
for i in range(account):
input("Enter the name of the client: ")
input("Enter the deposist of the client: ")
input("Enter the withdraral of the client: ")

Answers

Answer:

below is a version of your code that runs.

I'm not sure if it does what you expect it to do.

what three factors helped the Wright brothers achieve success in controlled sustained and powered flight?​

Answers

In 1903 the Wright brothers achieved the first powered, sustained and controlled airplane flight; they surpassed their own milestone two years later when they built and flew the first fully practical airplane.

Why Should You Love Your Job?

Answers

Answer:

I think you should love your job because if you get good grades in high school and collage you get to pick your job and it will be amazing for you in life!

Hope that helped :)

Help ASAP this assignment is due today!!!!

Answers

You want someone to do your assignment???

PLEASE ANSWER ASAP! 10 POINTS!

Answers

the answer : it’s 0, carry 1

What are some potential challenges that society will face given the digital revolution? You may want to think particularly of the news industry. Discuss how these challenges could impact young people such as yourself.

Answers

Answer:

Some said that technology causes more problems than it solves. ... Others said humans' uses and abuses of digital technologies are causing ... Highly technological societies have to be iterative if they hope to ... where we believe we can tell honestly delivered information from fake news and disinformation.

hope this helps...

Explanation:

Stacy plans to print her contacts and would like to choose an option that will print select information for each contact in a business card format. Which option should she choose?

Answers

Answer: card style

Explanation:

From the question, we are provided with the information that Stacy plans to print her contacts and the option that she would like to choose is an option that will print select information for each contact in a business card format.

Based on the above information that is given, the option that she should choose is the card style.

Read the code snippet below and determine which markup language it is:



Sound Card
Creative Labs
Sound Blaster Live
80.00



The code is an example of the (Blank) markup language.

Answers

Answer:

Sound Card

Explanation:

Write a program to convert centigrade to Kelvin. It should display value in centigrade and then the value in Kelvin just as you displayed squares in the previous question. The range to be followed for this conversion is from 50-100 degree celsius.

So, it should look like this:
1. Centrigrade: 50 --> Kelvin: 323.15
2. Centrigrade: 51 --> Kelvin: 324.15
3. Centrigrade: 52 --> Kelvin: 325.15
etc.

Answers

Answer:

for degree in range(50, 101):

   kelvin = degree + 273.15

   print("Centrigrade: {} --> Kelvin: {}".format(degree, kelvin))

Explanation:

*The code is in Python.

Create a for loop that iterates from 50 to 100 (Note that the starting value is included, but the ending value is not included in the range method. That is why you need to write range(50, 101) to iterate from 50 to 100)

Convert the centigrade to kelvin using formula (Note that the degree variable represents the each centigrade degree from 50 to 100 and you need to add 273.15 to convert it to Kelvin)

Print the result as in requested format

If you came across an article that discussed the benefits of studying the night before a test rather than the morning of, what could you do to form your own opinion about such information? A. Do your own research including reading articles related to the same topic. B. Ask a trusted family member their opinion after they read the article. C. Check different social media accounts for articles on sleep studies. D. Read another article on this topic written by the same journalist.

Answers

Answer:

A. Do your own research including reading articles related to the same topic.

Explanation:

To confirm online information that is not made by reputable experts, professionals, journals, or websites, it is always recommended to cross-check such information carefully. To do that is to make research on the same topic and confirm if the actual information is the same.

Hence, in this case, the correct answer is "Do your own research including reading articles related to the same topic."

how do you activate windows on a lenovo computer?

Answers

Answer:

Go to settings

Explanation:

Go to settings, buy an activation key, and activate Windows

Other Questions
What are some modern day examples of de facto segregation? PLZ HELPUse the text of the opinion piece, "What's for Lunch," and your completed graphic organizer to answer the question below. Include evidence from the article to support your answer. Do you think this author has an agenda? If so, what is it? If not, what is the purpose of her article? Does she achieve her purpose? Whats for Lunch?Marcia Amidon LustedZachary Maxwell was tired of trying to explain to his parents why he wanted to bring lunch to school instead of eating hot lunch. They couldnt understand why he didnt want to eat the gourmet food described on the schools online menu, which sounded both nutritious and interesting. Zachary just couldnt convince them that the food wasnt as great as it sounded. So in the fall of 2011, he began sneaking a small video camera into the cafeteria at his school, to show his parents what the lunches were really like. Six months and 75 school lunches later, Zachary made a documentary film about his lunch called Yuck: A 4th Graders Short Documentary About School Lunch. Im almost there just a a lil bit left !!! When adding two mixed numbers, you should add the ignore the fractions and add the mixed numbers first.TrueFalse 15. Which statements are true aboutsquare EFGH? Select all that apply.20.PEA FP=2(EG) MZEFH = 45DFH I EGB) EP= EH how was African religion used to organize or influence society? Which accurately describes differences between free blacks in the North and freeblacks in the South? LOTS OF POINTS! HELP VERY BAD! is the digestion of glucose passive or active transport president polk believed his presidential mandate authority was Two similar triangles have a scale factor of 3:5. Determine whether thefollowing statement about the triangles is true or false.Two corresponding sides could be 6cm and 8 cmWho ever answers truly gets brain list thing Whoever gives me the correct answer to this will get a brainlest I need the answer ASAP! jacks rope is 4 feet long how many inches is the rope Fill in the blank with the appropriate form of oublier.J'Lle nom du professeuroublierO oubliesO oublientO oublie Write 7.812 correct to 2 decimal places ASAP I NEED HELP Why did it take so long to get out of the Great Depression? In social studies what does welfare mean? What is 46x15?? Thank you so much! what do u do when the question says what is an area of the rectangle Like Division?Multiply?Subtract Or add PLEASE HELP!! view attachment!! The heights of two elevators can be modelled by linear functions. At time t = 0, Elevator A is 16 feet above ground floor. It descends at a rate of 4 feet per minute. The height of Elevator B is shown in the graph. Select all true statements.Elevator B graph of a diagonal line on a coordinate plane going down and to the right with Time in minutes on the x axis and height in feet on the y axis. The line begins at the point zero comma 16 and passes through the point 2 comma 10. Select all True Statements.The initial height of Elevator A is less than the initial height of Elevator B.Elevator A descends at a faster rate than Elevator B.Elevator A will reach the ground first.Elevator B will reach the ground first.The initial height of Elevator B is less than the initial height of Elevator A.