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]
2 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]2 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
What test must you pass to get you're operators licence
Alina [70]
Behind the wheel, the Florida driving test, turn about, shifting gears, parking, backing up, stop quickly, stop signs, signal & turns
5 0
3 years ago
What type of desktop system is Sarah using in the following scenario? Sarah types the phrase “Open Document 3” onto a black scre
Vedmedyk [2.9K]

I'd go with command-line interface.

A CLI enables users to type commands in a console or a terminal window expressed as a sequence of characters and presses the enter key on the keyboard to execute that command. And in this case, Sarah is typing an “open document 3” command to the command-line interface to open a file in her computer.

4 0
2 years ago
What option would you choose in order to store the database on a dedicated sql server?
Ganezh [65]
<span>Single processor servers offer high performance and locked-down security for any website or application. Upgrade to a bundle and save on services like backups and DDoS protection.</span>
7 0
3 years ago
1. Target area range is a survey of what lies about __________ seconds ahead of the vehicle. A. 5-10 B. 10-20 C. 20-30 D. 40-50
pshichka [43]

Answer:

Target area range is a survey of what lies about 12-20 seconds ahead of the vehicle. Correct Answer is B. (10-20 second)

Explanation:

Target area range is the space between your vehicle and the target area. A target area is an area on the roadway where the target is located. A target can be anything such as a car, a traffic signal, a blackhead, etc.

Target area range is also a section of roadway where the target is located and the area to the left and right of the target area

4 0
3 years ago
Read 2 more answers
What is the check digit for the following original product number: 140501941 ? *
Natasha_Volkova [10]

Explanation:

I think it is 7, but I could be wrong..... sorry

8 0
2 years ago
Read 2 more answers
Other questions:
  • This is a free point thing!! I am giving 100 points!! Anyone wanna talk!!!!
    11·2 answers
  • Using C#, declare two variables of type string and assign them a value "The "use" of quotations causes difficulties." (without t
    11·1 answer
  • A server that provides data transfer and storage space at remote locations is called a
    7·1 answer
  • In a typical e-mail address, what is the "host"? A. an account designated by a user name. B. the computer that houses an Interne
    7·1 answer
  • Rob creates a Course_Details table that has four columns: Course _ID, Course_Name, Semester and Credits. A course may have 0.5 c
    6·2 answers
  • Stuart wants to delete some text from a slide. What should Stuart do?
    8·1 answer
  • Can someone help I think I know it but I wanna make sure I’m right
    10·1 answer
  • Consider this binary search tree:______.
    12·1 answer
  • 1. Fill in the blanks:
    7·1 answer
  • Shandra recently bought a brand-new digital camera from a local camera shop but when she got it home, she noticed the lens was j
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!