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
Korolek [52]
3 years ago
8

Write multiple if statements. If car_year is 1969 or earlier, print "Few safety features." If 1970 or later, print "Probably has

seat belts." If 1990 or later, print "Probably has antilock brakes." If 2000 or later, print "Probably has airbags." End each phrase with a period and a newline.
Sample output for input: 1995
Probably has seat belts.
Probably has antilock brakes.

My code:

car_year = int(input())

if car_year <= 1969:
print('Few safety features.')
elif car_year ==1970:
print('Probably has seat belts.')
elif car_year >= 1990:
print('Probably has seat belts.\nProbably has antilock brakes.')
else:
car_year >= 2000
print('Probably has airbags.')

My output that keeps failing:
Testing with input: 2001
Output differs. See highlights below.
Special character legend
Your output
Probably has seat belts.
Probably has antilock brakes.
Expected output
Probably has seat belts.
Probably has antilock brakes.
Probably has airbags.
Computers and Technology
1 answer:
Nostrana [21]3 years ago
3 0

Your problem is that you're using elif and if statements. As soon as one of your statements is true, the other ones don't run. You need to use multiple if statements instead of the elif and else statements. For instance:

car_year = int(input())

if car_year <= 1969:

   print('Few Safety features.')

if car_year >=1970:

   print('Probably has seat belts.')

if car_year >= 1990:

   print('Probably has antilock brakes.')

if car_year >= 2000:

   print('Probably has airbags.')

I wrote my code in python 3.8. I hope this helps.

You might be interested in
What was the name of the first personal computer and what year was it introduced
Nadya [2.5K]

Answer:

IBM's own Personal Computer (IBM 5150) was introduced in August 1981, only a year after corporate executives gave the go-ahead to Bill Lowe, the lab director in the company's Boca Raton, Fla., facilities. He set up a task force that developed the proposal for the first IBM PC.

6 0
3 years ago
Hi tech was signed in what year
sleet_krkn [62]
It was signed in 2009..!!
hope its right!
6 0
3 years ago
Which type of link is normally used to interconnect two peripheral modules (pm) in the digital multiplex system (dms)?
natta225 [31]

The answer is DS-30A. The Roland DS30A is a 24-bit Digital Reference Monitor which can add pristine 24-bit/96kHz. They are small speakers.

4 0
3 years ago
Aight Ik this aint an assignment question but I just need to vent
eduard

Answer:

Your everything

Explanation:

That's your friends opinion that your "ugly" nothing will hurt it you don't take it to the heart. Don't be sorry, if they were truly your friend they wouldn't have said those. Your good yourself you don't have to have to have someone say you are good. You are good as yourself. Don't change, for anyone. Your beautiful. :) <33

4 0
3 years ago
4.5 Code Practice
dmitriy555 [2]

i = 0

while True:

   user_input = input("Please enter the next word: ")

   if user_input == "STOP":

       break

   i += 1

   print("#{}: You entered {}".format(i,user_input))

print("All done. {} words entered.".format(i))

First we set i equal to zero so that we can keep track of how many words we input.

We set while True so that its a continuous loop until a certain condition is met to break out of the loop.

user_input is set equal to whatever word the user enters.

our if statement tells us to break out of the while loop if the user inputs "STOP"

If the user does not enter STOP i is set equal to itself plus 1. This just means we add one to i for every new word entered.

Then we print whichever word is entered.

After the while loop, we print All done and the quantity of words entered.  

7 0
3 years ago
Other questions:
  • whats something that u want to do but ur parents wont allow it like having a phone or going to a college ​
    11·2 answers
  • What is the name given to the software testing technique, which basically consists of finding implementation bugs using malforme
    7·2 answers
  • What is the problem we can't build shelter on mars ?
    6·1 answer
  • What is value parameter and reference parameter while things are passed by Also, do a c code to show it
    13·1 answer
  • One of the network printers is producing copies where the toner is smeared on paper after printing. What component should be che
    11·1 answer
  • Which description of the plain text file format is most accurate?
    10·1 answer
  • Spreadsheet allow three types of cell addressing. They include ______addresses, such as $E$1, ______addresses, such as R$3, and
    12·1 answer
  • What causes the poles of the electromagnet in an audio speaker to repeatedly switch directions?
    6·2 answers
  • From few sometime I am unable to answer any question. Whenever I am clicking on Answer button it is taking me to logging page. B
    15·1 answer
  • Why should you keep lines of code short?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!