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
I need help please?!!!!!!!!!!
Debora [2.8K]

Answer:

Graduated Drivers License process

Explanation:

It gradually develops skills, just using logic. Hope it helped!

3 0
3 years ago
Read 2 more answers
Many people dream of being successful, but their actions can sometimes hold them back. What are some ways you can be sure that y
Nikitich [7]

Answer:

  • make a promise
  • write it in a diary
  • make a scrap book
  • create a video
  • make a picture book

I hope this helps

<h2>I know you will do great!!!</h2>

5 0
3 years ago
In what types of publications might you see a chart?
Nikitich [7]

Answer:

The answer to this question is given below in the explanation section. however, the correct answer is newspapers, magazines, and webpages.

Explanation:

This question is about what types of publications might have a chart(s).

The correct answer is newspapers, magazines and, webpages might have charts to show data in visual form.

For example, some business newspapers, periodically magazines, web pages, or online blogs may publish charts that show or represent data in visual form for the reader to understand data easily.

4 0
3 years ago
Some one tell me,Which C++ IDE is supported with Linux operating System, and How to Install it, please also provide some URL.I m
irakobra [83]

Answer:

There are many C++ IDE in the market which can be supported with Linux operating System. Couple of them are NetBeans IDE, Code::Blocks, Eclipse etc. These are some common and standard IDEs used in the industry. There are many which are available in the market.

Explanation:

The process of installation is by downloading the installer and follow the steps that are prompted on the screen. Basically all the installers provide the necessary .exe files and driver files required for the installation. On downloading the installers click the .exe file ( executable file ) and follow the instructions. These IDEs are supported in Linux Operating System. The URLs for NetBeans IDE, Code::Blocks IDE and Eclipse IDE are as below.

NetBeans IDE : https://netbeans.org/features/cpp/index.html

Codeblocks IDE : http://www.codeblocks.org/

Eclipse IDE : https://www.eclipse.org/cdt/

3 0
3 years ago
Class Product {
blagie [28]

Answer:

D. Compilation Fails

Explanation:

There is an error in the program, which if not correct will hinder the successful compilation of the program and will give a compilation error

The error is at doucble newPrice = 100;

The data type has to be spelt correctly to ensure the program is executed successfully

To declare variable newPrice of type double and also initialize it to 100, the right syntax is double newPrice = 100;

After correcting the error, the program will run correctly and produce the following result:

400.0 : 100.0

At line 2 of the main method, an instance of class Product is declared "Product prt = new Product();"

This allows values to be passed between the main method and the class

In class Test

price takes its value from newPrice (in the main method)

So, when newPrice is 100.0

price = 100.0 * 2

price = 200.0

After which product.price is calculated

product.price takes its value from prt.price (in the main method)

So, when prt.price is 200.0

product.price=product.price + price (Recall that price is 200.0; as illustrated above)

product.price = 200.0 + 200.0

product.price = 400.0

At line 5 of the main method, an instance of class Test is declared "Test t = new Test ();"

The next line t.updatePrice ( prt, newPrice);  assigns the calculated values to prt and newPrice respectively

prt = 400.0

newPrice = 100.0

The output is done on the next line: System.out.println(prt.price + " : " + newPrice);

prt.Price = prt = 400.0 and newPrice = 100.0

Hence, the output will be done in the following order 400.0 : 100.0

5 0
3 years ago
Read 2 more answers
Other questions:
  • My computer have black spots and line
    7·2 answers
  • Which feature of a social news sharing website distinguishes it from a social bookmarking website
    15·2 answers
  • (MCQ question). Which of the following files stores information about a local Google Drive installation such as User email ID, L
    6·1 answer
  • How to fix a light blub
    11·2 answers
  • HELP ME ILL GIVE BRAINLY Input 50 numbers and then output the average of the negative numbers only. Write in pseudocode!
    11·1 answer
  • What is one problem caused by spending too much time studying at your computer? A. It increases stress and negatively affects yo
    8·1 answer
  • Choose the missing method name.
    7·1 answer
  • To find information on a network use a ____
    14·1 answer
  • Directions: Give the shortcut key for the following commands: 1. Open 2. Save 3. New document 4. Copy 5. Undo 6. Redo 7. Paste 8
    5·1 answer
  • From which os did windows xp evolve?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!