Your program produced too much output! This is probably because of an infinite loop in your code.
I got this error when i submitted this code and it said that it occurred when it was testing a case of unusual capitalization.
The first code is below.
print "Hello, my name is Eliza. What would you like to talk about?"
a = raw_input()
b = a.lower()
c = b.replace(" ","")
d = ''
while c != "goaway":
if "feel" in b:
print "Do you often feel that way?"
elif " you"in b:
if "me" in b:
print "What makes you think I "+str(a[b.find("you")+4:b.find("me")-1])+" you?"
elif "iam" in c:
for i in a[b.find("i am")+5:]:
d = d+i
if i == " ":
break
print "How long have you been "+str(d).replace(" ","")+"?"
d = ''
else:
print "Please go on"
a = raw_input()
b = a.lower()
c = b.replace(" ","")
print "I hope I have helped you!"
The second code is below:
print "Hello, my name is Eliza. What would you like to talk about?"
a = raw_input()
b = a.lower()
c = b.replace(" ","")
d = str()
while b != "go away":
b = a.lower()
c = b.replace(" ","")
d = str()
if "feel" in b:
print "Do you often feel that way?"
a = raw_input()
elif " you"in b:
if "you" and "me" in b:
print "What makes you think I "+str(a[b.find("you")+4:b.find("me")-1])+" you?"
a = raw_input()
else:
a = raw_input()
elif "iam" in c:
if "i am" in b or a[0] == "i am":
for i in a[b.find("i am")+5:]:
d = d+i
if i == " ":
break
print "How long have you been "+str(d).replace(" ","")+"?"
a = raw_input()
elif "feel" and "iam" and "you" not in c:
if b !="go away":
print "Please go on"
a = raw_input()
if b =="go away":
print "I hope I have helped you!"
You can also view the second code by clicking here.
Thanks.


Sign In
Create Account

Back to top









