Why NameError?
I can't run this> NameError: name 'karl' is not defined, showrobotdialogue, 16, , 20 What's happen please tell me thank you
my code:
VOWELS = "aeiou" import re
class Chat: def showhumandialogue(self): print ("show_human") result=karl.text+" "+bot.text print (result) return result
def show_robot_dialogue(self): print ("show_robot") result=karl.text_+" "+bot.text_ print (result) return result def connect_human(self,karl): self.name_human = karl.name print ("name_human",self.name_human) def connect_robot(self,bot): self.name_robot = bot.name print ("name_robot",self.name_robot)
class Human: def init(self,name): self.name = name print("init",self.name)
def send(self,text): text_="" for i in text: if(i in VOWELS): text_+="0" else: text_+="1" self.text = self.name+" said: "+text self.text_ = self.name+" said: "+text_ print ("Human__",self.name,"said:",text)
class Robot: def init(self,name): self.name = name print("init",self.name)
def send(self,text): text_="" for i in text: if(i in VOWELS): text_+="0" else: text_+="1" self.text = self.name+" said: "+text self.text_ = self.name+" said: "+text_ print ("send__",self.name,"said:",self.text)