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循環錯誤
它是一個新東西的奧奇。但我可以建議你看看這些系列的視頻:http://www.youtube.com/watch?v=tKTZoB2Vjuk&ob=av3e或類似的東西?這將花費你幾個小時,但它將是完全值得的。你會對事物的工作有一些基本的瞭解:) – 2012-01-07 09:44:36