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
WILL GIVE 100 POINTS AND GIVE BRAINIEST TO THE FIRST PEOPLE THAT ANSWER CORRECTLY!!!!!! Marcus wants to create a spreadsheet wit
maks197457 [2]

Answer:

tell me bar

Explanation:

5 0
4 years ago
Read 2 more answers
4.which pre-defined feature is known as functions in Excel?<br> a.formula<br> b.property<br> c. data
lesya692 [45]

Answer:

I think formula?

Explanation:

8 0
3 years ago
Pedro is at a conference for computer programmers and wants to attend a session on new features in software that help write code
Natasha_Volkova [10]

Answer:

1) Variable Management for Beginers

6 0
3 years ago
If when I evaluate the security readiness of a web server I find an issue in the code that might allow an SQL injection attack,
Ghella [55]

Answer:

Vulnerability

Explanation:

Vulnerability is a cyber-security term that refers to a flaw in a system that can leave it open to attack. A vulnerability may also refer to any type of weakness in a computer system itself, in a set of procedures, or in anything that leaves information security exposed to a threat. Vulnerabilities are what information security and information assurance professionals seek to reduce. Cutting down vulnerabilities provides fewer options for malicious users to gain access to secure information.

3 0
3 years ago
Which framework can be used to develop cross-platform applications?
k0ka [10]

Answer:

Qt framework

Explanation:

3 0
3 years ago
Other questions:
  • ______ are segments of computer code that attach to existing computer programs and perform malicious acts. select one:
    7·1 answer
  • Bill needs to make a presentation in which he has to represent data in the form of a pyramid. Which feature or menu option of a
    10·2 answers
  • What is the<br><br> stored program concept?
    8·1 answer
  • Help, please!! A file named "games.txt" exists and has 80 lines of data. You open the file with the following line of code. aFil
    6·1 answer
  • What is the advantage of using the clipboard task pane?
    7·1 answer
  • What's the name of all kind of money around the world
    5·2 answers
  • Why do we say that IP provides ""best-effort"" service?
    11·1 answer
  • What a promblem Hypothesis<br>​
    8·2 answers
  • Describe how to create a new folder on the desktop​
    12·2 answers
  • PLEASE HELP ASAPP!!
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!