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
PLEASE PLEASE PLEASE PLEASE help me Im completly lost will give brainliest and 50 points
pav-90 [236]

It can be either a or b.. I suggest go with b

3 0
3 years ago
Read 2 more answers
Which plot element is typically the turning point in the most intense moment of a story
Valentin [98]

The climax. The climax is when the story peaks and has the most suspense. The story falls closer to it's end after the climax.

4 0
3 years ago
Read 2 more answers
How to unblock your Wi-fi if it is blocked by your administrator .
alexgriva [62]

Answer:

you dont

Explanation:

you ask the admin to unblock it. if you dont know who did it, you had your ip grabbed and you cant do anything but call the police.

3 0
3 years ago
Assume that you are testing the Orders database introduced in Watt (2014) - Appendix C. Discuss the problems and possible conseq
madreJ [45]

Answer:

129 \frac{2}{?} 23.4. \div 164 \times 5y1 + . \\ .00487ggh

6 0
4 years ago
With what for a human may a heatsink in the computer be compared? a crispy lettuce salad an ice cold drink of water a sizzling s
Marysya12 [62]

Answer: I'd say an ice cold drink

7 0
4 years ago
Other questions:
  • _____ performs a real-time lookup of a digital certificate’s status. Group of answer choices Certificate Revocation List (CRL) R
    6·1 answer
  • Assume that x is a char variable that has been declared and already given a value . write an expression whose value is true if a
    8·1 answer
  • Why would a designer choose to use an isometric sketch rather than a perspective sketch to share their idea with a design team m
    14·1 answer
  • The activities that gather information about the organization and its network activities and assets is called fingerprinting. __
    14·1 answer
  • Fill the validateForm function to check that the phone number contains a number (use the isNaN function) and that the user name
    8·1 answer
  • The problem with the media giving equal air time to those who are __________ about the effects of media violence on violent beha
    9·1 answer
  • Glven an array named Scores with 25 elements, what is the correct way to assign the 25th element to myScore? A. myScores + 25 B.
    10·1 answer
  • How do i convert videos on the computer
    10·1 answer
  • Is this right? I’m not sure
    15·1 answer
  • Can someone please help me? (,:
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!