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
Yall rachits and yall eat butt xD
Trava [24]
Please use this for questions.
6 0
3 years ago
Read 2 more answers
3.1.1 What type of goods are car radio and remote control.​
Nuetrik [128]

Answer:

Radio Controlled cars .

4 0
2 years ago
The exercise instructions here are LONG -- please read them all carefully. If you see an internal scrollbar to the right of thes
AnnyKZ [126]

Answer:

The following codes are:

int monthOfYear=11;

 // integer type variable is initialized

long companyRevenue=5666777;

 // long type variable is initialized

int firstClassTicketPrice=6000;

 // integer type variable is initialized

long totalPopulation=1222333;  //// long type variable is initialized

Explanation:

Here, we define integer type variable "monthOfYear" to 11.

Then, we define long type variable "companyRevenue" to 5666777.

Then, we define integer type variable "firstClassTicketPrice" to 6000.

Then, we define long type variable "totalPopulation" to 1222333.

8 0
3 years ago
A ________ infrastructure is a framework that consists of programs, procedures,and security policies and employs public key cryp
Norma-Jean [14]

Answer:

The answer is "Public Key".

Explanation:

PKI stands for public key infrastructure. It is a collection of functions, protocols, equipment, code, and procedures that require to create, maintain, transmit, store and cancel encrypted certs and handle the authentication of a public key.  

  • It is used to sign documents digitally.
  • It works for propagating with Trojans and other malware.
5 0
3 years ago
Why do some people have random numbers as their usernames?
Angelina_Jolie [31]
Mostly for privacy or to not get caught looking up answers probably
3 0
2 years ago
Read 2 more answers
Other questions:
  • What is computer? Explain the characteristics of computer.<br>​
    12·1 answer
  • Which of these is not a modifier?<br><br> short<br><br> unsigned<br><br> nest<br><br> long
    15·1 answer
  • Individuals with desirable traits will be __________ to have young that survive than individuals without these traits. (2 points
    5·2 answers
  • NEED HELP NOW 25 POINTS WILL MARK BRAINLIEST!!!!!!!
    8·1 answer
  • As in algebra, you can use brackets to override the order of operations Excel follows to perform formula calculations. True or f
    13·1 answer
  • Name the contributions of Steve Jobs and Bill Gates, with respect to technology.
    5·1 answer
  • Name an analog quantity other than temperature and sound
    13·1 answer
  • What term is used to refer to the merging of government services with information technology?
    11·1 answer
  • In a relational database, the three basic operations used to develop useful sets of data are:_________.
    14·1 answer
  • Problem: Mr. James Reid, the director of admissions at MOGCHS University, has
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!