0

I was making a chat robot in python but when I executed the code I got an eof error here is the code:

ai_talked= "0"
textreadyyet="no"
playermessage = input("Talk here:")

def playertalk():
 while textreadyyet=="no":
  if textreadyyet== "Yes":
   print(playermessage)
  else:
   textreadyyet= "Yes"
   print(playermessage)
  
  
  playertalk()
  print(playermessage)
  
  def aialk():
    if ai_talked=="0":
        print("Hello!")

  aialk()

it gives an eof error in the 3rd line

Idopython
  • 1
  • 1
  • did you press an enter after the prompt shown? – devReddit Jul 11 '21 at 18:30
  • also did You enter any text? – Matiiss Jul 11 '21 at 18:59
  • Related question: https://stackoverflow.com/questions/17675925/eoferror-eof-when-reading-a-line. Also `textreadyyet` needs to either passed to `playertalk()` as an argument or as `global textreadyyet` within the function, or else that will become an error as well. – Flair Jul 11 '21 at 21:47

0 Answers0