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
You interact with a program through which of the following, thereby controlling how you enter data and instructions and how info
kaheart [24]

Answer:C)User interface

Explanation: User interface(UI) is the interaction phase of the user or programmer with the computer system and network. This phase helps the user to connect with the operating system function and let them process it according to the requirement. Example-monitor , keyboard, mouse etc.

Other options that are given are incorrect because operating system is the system that is part of the interface , information is the data and storage is for the storing of data,.Thus the correct option is option(C)

4 0
3 years ago
Read 2 more answers
Match the following:
Bogdan [553]

Answer:

  1. Operating System.
  2. Laptop.
  3. Convertible computer.
  4. Peripheral.
  5. Desktop Computer.

Explanation:

Operating system is a software that manages the hardware and the software in the system and provides the interface between machine and the user.

Laptops are the portable computing devices which you can carry with you.

Convertible computer have a keyboard that is detachable and can be converted into a tablet.

Peripherals are devices which we can attach to the computer.

Desktop computer is a computing device that not portable at all.

3 0
3 years ago
Helllp me you will git 16 points
siniylev [52]

Answer:

False

Hope it helps...

Have a great day :P

8 0
3 years ago
Read 2 more answers
Create a for-loop which simplifies the following code segment: penUp(); moveTo(100,120); turnTo(180); penDown(); moveForward(25)
kvasek [131]

Answer:

for(var i=0; i<3; i++) {

  penUp();

  moveTo(100,120);

  turnTo(180);

  penDown();

  moveForward(25);

}

Explanation:

The i variable is the loop dummy. The code block will be executed 3 times.

7 0
3 years ago
You are running cable for a temporary network in a large auditorium. What is the maximum length you can have for the Ethernet ca
mote1985 [20]

It would be about 1K yards because it is a, as you stated<em> and</em> not to be rude, a large auditorium and 1K yards is the biggest number there.

4 0
3 years ago
Other questions:
  • Henry uploaded the photos of his birthday to a cloud storage system. He feels that it’s a safe option for data storage. His frie
    12·1 answer
  • Read the following code carefully and do as directed: int main() { // Initialising starting number int num = 1; int n=7 // Outer
    5·1 answer
  • What function should be entered into B7 to calculate the total budget
    15·2 answers
  • Thank you very much for your email. ...... was very interesting​
    15·1 answer
  • Which job role requires you to create user guides for computer products and services?
    11·1 answer
  • What year did the first hovercraft sail on water
    15·1 answer
  • Help fast plzzzzzzzzzzzz ​
    10·2 answers
  • 15) Three primary activities of a program are: A) Variables, Operators, and Key Words B) Lines, Statements, and Punctuation C) I
    11·1 answer
  • Bob The Penguin is a real you-tuber, and he plays Mine-craft. Who is his owner?
    6·1 answer
  • Pls say correct guyz pls pls pls
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!