Code:
numl = int (input("Enter a number: "))
num2 = int (input("Enter a number: "))
num3 = int (input("Enter a number: "))
print ("The average is:" + ((numl + num2 + num3)/3))
Answer:
It needs a str command
Step-by-step explanation:
Given
The above code
Required
Determine and correct the error
At the last line of the code, there is an attempt to print the average of the three numbers.
However, this will return an error because:
In order to print the literal "The average is:" and the numeric value of (numl + num2 + num3)/3, a str command is needed.
This converts (numl + num2 + num3)/3 to a literal and then print without error.
So, the correct instruction is:
print ("The average is:" + str((numl + num2 + num3)/3))