Ask Question
13 February, 10:56

Write multiple if statements: If carYear is before 1967, print "Probably has few safety features." (without quotes). If after 1970, print "Probably has head rests.". If after 1991, print "Probably has electronic stability control.". If after 2002, print "Probably has airbags.". End each phrase with period and newline. Ex: carYear = 1995 prints:

+5
Answers (1)
  1. 13 February, 13:11
    0
    The solution code is written in Python 3.

    carYear = 1995 if (carYear <1967) : print ("Probably has few safety features./n") if (carYear> 1970) : print ("Probably has head rests. / n") if (carYear > 1991) : print ("Probably has electronic stability control./n") if (carYear > 2002) : print ("Probably has airbags. / n")

    Explanation:

    Firstly, create a variable, carYear to hold the value of year of the car make. (Line 1)

    Next, create multiple if statements as required by the question (Line 3-13). The operator "<" denotes "smaller" and therefore carYear <1967 means any year before 1967. On another hand, the operator ">" denotes "bigger" and therefore carYear > 1970 means any year after 1970.

    The print statement in each of the if statements is done using the Python built-in function print (). The "/n" is an escape sequence that create a new line at the end of each printed phrase.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write multiple if statements: If carYear is before 1967, print "Probably has few safety features." (without quotes). If after 1970, print ...” in 📙 Engineering if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers