191k views
4 votes
What, if anything, is wrong with this code?

student_score = int(input("Enter this student's score: "))
score = student_score + 5
print("With the 5-point curve, the student's score is ", scores, "."
a. nothing is wrong with this code
b. a string variable is used in an arithmetic expression
c. an undeclared variable name is used in the print() function
D. the input() function is chained with the int() function

User Nuander
by
8.7k points

1 Answer

3 votes

Final answer:

The code contains a mistake where an undeclared variable 'scores' is used in the print statement. The correct variable 'score' should be used to display the updated student score with the curve applied.

Step-by-step explanation:

The issue with the given code is that it uses an undeclared variable name in the print() function. Instead of using the variable score that contains the new total after adding 5 points, the code uses scores which has not been defined earlier. This will cause a NameError when the code is run.

To correct this code, replace scores with score in the print() statement:

print("With the 5-point curve, the student's score is ", score, ".")

User Jeanell
by
8.4k points