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
Your client expresses that they want their new website to have a responsivedesign with consistent coding. They are concerned wit
tresset_1 [31]

D

Explanation:

Because that's the one that works good together

5 0
3 years ago
How do i open screenshots on school chromebook?
yuradex [85]

Answer:

you have to open your file explorer and open the screenshot folder.

Explanation:

3 0
2 years ago
Read 2 more answers
When green, this signal means __________ A. yield to pedestrians and vehicles that are still in the intersection. B. you have th
Ivan
When green, the signal means D. all of the above.

A green traffic signal means that you have the right-of-way, but you must yield to pedestrians and vehicles already in the intersection. If you hesitate or slow down, you may cause an accident or hold up traffic behind you, so it is important that you move swiftly and carefully to avoid causing any problems.
4 0
3 years ago
Read 2 more answers
How should technology be used?
Alisiya [41]

Make Sure You Use The Right Technology.

Use Incorporate Automation Tools.

Manage Passwords Effectively.

Only Use Technology Where You Need Help The Most.

Use Chrome Extensions.

Organize Your Time With A Calendar App.

Take Advantage Of Free Applications.

Hope it helps!

6 0
3 years ago
Read 2 more answers
The part of the computer that provides access to the internet is the
mariarad [96]

Answer:

The Answer B Modem

Explanation:

That is the only way that you want connect to the internet no other part can connect.

Unless you use a ethernet.

Please rate and heart.

thank you for posting this question i am glad i could answer it.

Please make this a brianliest answer thank you.

7 0
3 years ago
Other questions:
  • Is a growing network of physical objects that have sensors connected to the internet?
    15·1 answer
  • ____ is a practice where a user in enticed by possible rewards and then asked to provide personal information.
    14·1 answer
  • "Smart-Toys-Smart Kids" is a toy manufacturing company. They are providing toys to more than 100 different Toy retail stores in
    8·1 answer
  • ______ is the software that prevents people from being able to access your personal information.
    8·2 answers
  • The data in a database management system that identifies the names of​ tables, fields in each​ table, and the properties of each
    13·2 answers
  • Treat others the way
    5·2 answers
  • If you forget your privacy password what will you do if the ask this question what is the name of one of your teacher?​
    12·1 answer
  • A signal causes the operating system to stop and assess what to do next.( Identify the name of this signal.)​
    5·1 answer
  • Leslie’s parents put a big dry-erase board on the refrigerator and let the kids write suggestions for how to organize and assign
    14·1 answer
  • How do I text lauraasher811 on brainly?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!