代码拉取完成,页面将自动刷新
import random
responses = ['It is certain','It is decidedly so','Without a doubt','Yes definitely ','You may rely on it','As I see it, yes','Most likely ','Outlook good','Yes','Signs point to yes','Do not count on it','My reply is no',' My sources say no',' Outlook not so good','Very doubtful', 'Reply hazy try again','Ask again later','Better not tell you now ','Cannot predict now ','Concentrate and ask again']
print("Hi! I am the magic 8 ball, what's your name?")
name = input()
print("Hello!"+ name)
def magic8Ball():
print("Whay's your question? ")
question = input()
answer = responses[random.randint(0,len(responses)-1)]
print(answer)
tryAgain()
def tryAgain():
print("Do you wanna ask any more questions? press Y for yes and any other key to exit ")
x = input()
if(x == 'Y'):
magic8Ball()
else:
exit()
magic8Ball()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。