while True:
inp = raw_input()
if inp == "":pres= input("What would you like to know about me? AGE, JOKE, FACT")
if pres in {'AGE'}:
print("I was birthed from my mother 87 years ago.")
if pres in {'JOKE'}:
print("Where do polar bears keep their money?")
import time
time.sleep(2)
print("In a snow bank!")
if pres in {"FACT"}:
print("Hippopotamus's have pink spit!")
我是一个学生,我的学校项目必须做一个代码,出于某种原因,我不知道如何让聊天机器人回答问题时,有人把年龄,笑话或事实。相反,当我按回车键时,它只是重复这个问题。你知道吗
您正在
while True
循环中请求输入。它永远不会退出,因为True
是。。。永远是真的。您需要将if
语句放入循环中,以便它们也可以执行。你知道吗相关问题 更多 >
编程相关推荐