print("Hi im a PC and my name is Micro, What's your name?")
name = raw_input("")
print("Hi " + name + " how are you, are you good?")
answer = (raw_input(""))
if answer == "yes":
print("That's good to hear!")
elif answer == "no":
print("Oh well")
while answer != ("yes","no")
print("Sorry, you didnt answer the question properly, Please answer with a yes or no.")
print"I'm going to sleep for 5 seconds and then i'll be back."
import time
time.sleep(5)
print"I'm back!"
需要为yes或no位创建一个循环,有人知道怎么做吗? 谢谢你的帮助!你知道吗
现在是完全不同的事情:
正如您所说的您是Python的noob,我想在这里介绍一些新的东西来补充您可能会发现有用的另一个答案。你知道吗
使用
while True:
,当您想停止循环时,使用break
。你知道吗这将是您的代码,而不是:
相关问题 更多 >
编程相关推荐