好的,在这里
done = False
while not done:
quit = input ("Do you want to quit? ")
if quit == "y" :
done = True;
if not done:
attack = input ("Does your elf attack the dragon? ")
if attack == "y":
print ("Bad choice, you died.")
done = True;
但是当我到达
Do you want to quit?
我进入
n
我明白了
Traceback (most recent call last):
File "C:\Users\your pc\Desktop\JQuery\dragon.py", line 4, in <module>
quit = input ("Do you want to quit? ")
File "<string>", line 1, in <module>
NameError: name 'n' is not defined
根据这个 http://www.youtube.com/watch?feature=player_embedded&v=2Z2pH0Ls9Ew#!它应该工作