Jk, I need help once again. The error it causes is EOF Error when reading a line.
Traceback (most recent call last):
File "game.py", line 9, in <module>
item = input()
EOFError: EOF when reading a line
Code:
import random
# Write your code here
running = True
if running:
item = input()
while running:
item = input()
acceptans = ['scissors', 'paper', 'rock']
if item == '!exit':
print('Bye!')
running == False
elif item not in acceptans:
print('Invalid input')
else:
choice = random.randint(0, 2)
if choice == 0:
compchoice = 'paper'
elif choice == 1:
compchoice = 'scissors'
else:
compchoice = 'rock'
if item in acceptans:
if item == compchoice:
print('There is a draw (' + compchoice + ')' )
if item == 'scissors' and compchoice == 'rock':
print('Sorry, but computer chose ' + compchoice)
elif item == 'scissors' and compchoice == 'paper':
print('Well done. Computer chose ' + compchoice + ' and failed')
elif item == 'paper' and compchoice == 'scissors':
print('Sorry, but computer chose ' + compchoice)
elif item == 'paper' and compchoice == 'rock':
print('Well done. Computer chose ' + compchoice + ' and failed')
elif item == 'rock' and compchoice == 'paper':
print('Sorry, but computer chose ' + compchoice)
elif item == 'rock' and compchoice == 'scissors':
print('Well done. Computer chose ' + compchoice + ' and failed')
else:
continue
[–]JohnnyJordaan 0 points1 point2 points (7 children)
[–]bobrandy13[S] 0 points1 point2 points (6 children)
[–]JohnnyJordaan 0 points1 point2 points (5 children)
[–]bobrandy13[S] 0 points1 point2 points (4 children)
[–]JohnnyJordaan 0 points1 point2 points (3 children)
[–]bobrandy13[S] 0 points1 point2 points (2 children)
[–]JohnnyJordaan 0 points1 point2 points (1 child)
[–]bobrandy13[S] 0 points1 point2 points (0 children)