Our goal here is to predict whether an accident just reported will involve an injury (MAX_SEV_IR = 1 or 2) or will not (MAX_SEV_IR = 0). For this purpose, create a dummy variable called INJURY that takes the value "yes" if MAX_SEV_IR = 1 or 2, and otherwise "no."

Respuesta :

Explanation:

The outlines given in question statement can be written in many programming languages. The below program would be written in C language, which is one of the basic computer languages

Program code

String main (int MAX_SEV_IR)

{

string INJURY

if (MAX_SEV_IR = =1 or MAX_SEV_IR == 2)

INJURY = "yes"

elseif (MAX_SEV_IR = =0)

INJURY = "No"

else

INJURY = "Invalid data"

return INJURY

}

Answer:

# main function is defined

def main():

# the value of MAX_SEV_IR is gotten

# from the user via keyboard input

MAX_SEV_IR = int(input ("Enter MAX_SEV_IR: ")

# if statement to check for prediction

# if MAX_SEV_IR == 1 or 2

# then there is injury and it is displayed

if (MAX_SEV_IR == 1 or MAX_SEV_IR == 2):

print("INJURY = ", injury)

print("PREDICTION: Accident just reported will involve an injury")

# else if MAX_SEV_IR == 0 then no

# injury and it is displayed

elif (MAX_SEV_IR == 0):

injury = "NO"

print("INJURY = ", injury)

print("PREDICTION: Accident just reported will not involve an injury")

# the call main function to execute

if __name__ = '__main__':

main()

Explanation:

The code is written in Python and well commented.