Ask Question
3 April, 17:35

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. 3 April, 17:48
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers