I got an EOFError at line 87 of the following code:
import random
def printDice(diceList):
upperLine=" _____ _____ _____ _____ _____"
line1="|"
line2="|"
line3="|"
lowerLine=" ----- ----- ----- ----- -----"
for i in range(len(diceList)):
if(diceList[i]==1):
line1+=" "
elif(diceList[i]==2):
line1+="* "
elif(diceList[i]==3):
line1+="* "
elif(diceList[i]==4):
line1+="* *"
elif(diceList[i]==5):
line1+="* *"
else:
line1+="* *"
if(i==4):
line1+="|"
else:
line1+="| |"
for i in range(len(diceList)):
if(diceList[i]==1):
line2+=" * "
elif(diceList[i]==2):
line2+=" "
elif(diceList[i]==3):
line2+=" * "
elif(diceList[i]==4):
line2+=" "
elif(diceList[i]==5):
line2+=" * "
else:
line2+="* *"
if(i==4):
line2+="|"
else:
line2+="| |"
for i in range(len(diceList)):
if(diceList[i]==1):
line3+=" "
elif(diceList[i]==2):
line3+=" *"
elif(diceList[i]==3):
line3+=" *"
elif(diceList[i]==4):
line3+="* *"
elif(diceList[i]==5):
line3+="* *"
else:
line3+="* *"
if(i==4):
line3+="|"
else:
line3+="| |"
print upperLine
print line1
print line2
print line3
print lowerLine
tellMe="N"
print
print "The purpose of the game is to figure out the rule."
print "I can tell you three things:\n1. The name of the game is petals around a rose, the name is important.\n2. I can tell you whether or not your guess is right and the score of the dice.\n3. I can tell you that the score is always even or 0"
print
print "At any time you can quit by typing an odd number"
go="Y"
wrongGuesses=0
while(go=="Y"):
diceList=[]
score=0
rightWrong="N"
for i in range(5):
diceList.append(random.randrange(1,7))
for i in range(5):
if(diceList[i]==3):
score+=2
elif(diceList[i]==5):
score+=4
printDice(diceList)
print
while(rightWrong=="N"):
guess=input("What is your guess? ")
if(guess%2==1):
break
if(guess!=score):
print "Wrong"
wrongGuesses+=1
tellMe=raw_input("Tell you (Y or N)? ")
tellMe=tellMe.upper()
if(tellMe=="Y"):
print "The score was "+str(score)+"."
rightWrong="Y"
else:
rightWrong="Y"
print "Right"
if(wrongGuesses%13==0 and wrongGuesses!=0):
print"The name is very important."
if((wrongGuesses==30) and (wrongGuesses!=0)):
print "The maximum score is 20."
print
I was using the site codepad.org to run this program. I have actually run this program in an IDE but when I use this site this error pops up:
What is your guess?
Traceback (most recent call last):
Line 88, in <module>
guess=input("What is your guess? ")
EOFError