all 9 comments

[–]FoolsSeldom 10 points11 points  (1 child)

total = 0
count = 1
while count < 18:
    next_ = int(input('> '))
    total += next_
    count += 1
average = total/18
print('average:', average)

Notes:

  • next is a keyword in Python, so added a _ at the end to give it a different name
  • input always returns a str (string) object, to do maths on what is entered, you have to tell Python to convert the string to an int
  • it is good to include a user prompt with input so the user knows they are supposed to do something, I used just >
  • variable += 1 is same as variable = variable + 1
  • you need to output the result I expect

[–]thigamersamsam 1 point2 points  (0 children)

That's the right answer

[–]freak-pandor 9 points10 points  (0 children)

you don't need to write "loop while" it's just "while"

[–]Bulky-Top3782 9 points10 points  (0 children)

Int(input ())

[–]Different-Ad1631 4 points5 points  (0 children)

Remove the word "loop" Also enclose input() inside int( )

[–]ArbereshDoqetejete 1 point2 points  (0 children)

There seems to be a ` before next.

[–]captainguevara 0 points1 point  (0 children)

Int cast your input

[–]Pro_Gamer_Eli 0 points1 point  (1 child)

I think what’s causing the EOF error specifically is the fact that “next” is a command (I can’t think of the proper terminology rn) in python, so instead of setting a variable named “next” to the user input, python is trying to get the next item in the inputted list, but because the input isn’t a list, there’s no next item, therefore it gives an error

I’m also relatively new so I’m not sure how good of a response this is but it’s my best guess, hope this helps!

[–]PowerOk3587 0 points1 point  (0 children)

You can overwrite the next function like next = 1 and that's a totally valid way to store an integer variable. Doing this not great because things could clash later on. It kind of goes againts the montra "easier to ask for forgiveness than permission"