1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
djyliett [7]
3 years ago
9

My code get an input of 1900 and it should output not a leap year but it fails first line of code. It should output not a Leap a

ny number with 1500 not divisble by 4 with/out a remainder should output (not a leap year. )
input_year = int(input())

if input_year % 4 == 0: #fails on this step, 1900 should be false
print(input_year, "- is Leap Year")

elif input_year % 100 == 0:
print(input_year, "- leap year")

elif input_year % 400 ==0:
print(input_year, "is a leap year")

else:
print(input_year, "- not a leap year")
Computers and Technology
1 answer:
marshall27 [118]3 years ago
3 0

Answer:

Explanation:

The code does not fail on the first step since 1900 divided by 4 is actually 475 and has no remainder, meaning that it should return True. The code won't work because the if statements need to be nested in a different format. The correct algorithm would be the following, which can also be seen in the picture attached below that if we input 1900 it would output is not a leap year as it fails on the division by 400 which gives a remainder of 0.75

input_year = int(input())

if input_year % 4 == 0:

   if input_year % 100 == 0:

       if input_year % 400 == 0:

           print(input_year, "is a leap year")

       else:

           print(input_year, "- not a leap year")

   else:

       print(input_year, "is a leap year")

else:

   print(input_year, "- not a leap year")

You might be interested in
The photographer for "The Migrant Mother" photograph used _______________, which is a technique that would be considered unethic
d1i1m1o1n [39]

Answer:

The technique used by the photographer which would be considered unethical today is:

Stage Managing

Explanation:

  • The Migrant Mother is a famous that was captured by the photographer named Dorothea Lange. This photograph was taken during the era of great depression that shows the misery of a women as well as her courage.
  • The photographer used the stage managing technique because the women in the photograph purposefully posed for the picture in order to let others know about their plight. She wanted to develop awareness as well as wanted the Government to help farmers.
  • The name of the women in the picture is Florence Owens Thompson and she was a mother of seven children. She lived in California.

8 0
3 years ago
Read 2 more answers
If you want to distribute a formatted Microsoft word document to people who don't have word save it as a __file
Helga [31]
If you want them only to read it and not change it send as a .pdf else I would send as a .txt file. Hope that helps
5 0
3 years ago
What is the Windows command to see the IP configuration of the PC?
lisov135 [29]
The answer is ipconfig
4 0
3 years ago
Write a simple Html structure and explain the meaning of each line
seropon [69]

Answer:

HTML stands for HyperText Markup Language and is the basic structural element that is used to create webpages. HTML is a markup language, which means that it is used to “mark up” the content within a document, in this case a webpage, with structural and semantic information that tells a browser how to display a page. When an HTML document is loaded by a web browser, the browser uses the HTML tags that have marked up the document to render the page’s content.

There are three types of code that make up a basic website page. HTML governs the structural elements, CSS styles those elements, and JavaScript enables dynamic interaction between those elements.

7 0
2 years ago
Q1. Information systems that monitor the elementary activities and transactions of the organizations are: I a. Management-level
VashaNatasha [74]

Answer:

B. Operational-level systems monitor the elementary activities and transactions of the organization.

6 0
2 years ago
Other questions:
  • What is a block cipher algorithm that operates on 64-bit blocks and can have a key length from 32 to 448 bits?
    8·1 answer
  • Wireless networks are the most difficult type of network to set up <br> true or false
    15·1 answer
  • What is data anayltics
    5·1 answer
  • In a ______topology, every device has exactly two neighbors for communication purposes. A failure in any cable or device can tak
    15·2 answers
  • Many companies use telephone numbers like 555-GET-Food so the number is easier for their customers to remember. On a standard te
    6·2 answers
  • Whats the correct answer
    15·2 answers
  • Which of these statements about tags is false?
    12·1 answer
  • Cómo fue posible que los alemanes exterminando seres humanos​
    11·1 answer
  • Which terms represent the two types of client requirements?
    7·2 answers
  • Who are all the fnaf characters?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!