I was trying to run this code:
def main():
print("This program computes the average of two exam scores.")
score1, score2 = input("Enter two scores separated by a comma:")
average = (score1 + score2) / 2.0
print("The average of the score is:", average)
When I call main()
I get this ValueError
:
ValueError: too many values to unpack (expected 2)
What is wrong with this code?
score1 + score2
will do string addition otherwise and you will get an error.