1

In the last line I'm trying to round the output one decimal place but when i test this i get a unexpected EOF error. Help Please?

count = 0
scoreSum = 0
score = 0
while score != 999:
    score = float(input("Enter test score or enter 999 to finish: "))
    if score > 0 and score < 100:
        scoreSum += score
        count += 1
    elif (score <0 or score > 100) and score != 999:
        print("This score is invalid, Enter 0-100")
else:
    print ("your average is: ", round((scoreSum / count), 2)
MrAlex42
  • 35
  • 1
  • 1
  • 6

3 Answers3

3

Last line should be:

print ("your average is: ", round((scoreSum / count), 2))

You miss one closing parenthesis.

The complete error message was probably 'unexpected EOF while parsing', which is indeed a bit cryptic. Pro-tip: In future, if you find some error you do not understand, always past the complete error message directly into Google. In most cases, someone else already asked about the same problem.

Community
  • 1
  • 1
Bas Swinckels
  • 18,095
  • 3
  • 45
  • 62
2

The last line is your problem--you need a closing parenthesis:

print ("your average is: ", round((scoreSum / count), 2))
#                                            right here ^

Actually, you could have your line of code be this:

print("your average is: ", round(scoreSum / count, 2))

There is no need for those extra parenthesis.

0

You are missing a closing parenthesis at the end of:

print ("your average is: ", round((scoreSum / count), 2))
                                                        ^ THIS
NPE
  • 486,780
  • 108
  • 951
  • 1,012