這裏沒有響應是我的代碼:Python的環路
from random import randint
doorNum = randint(1, 3)
doorInp = input("Please Enter A Door Number Between 1 and 3: ")
x = 1
while (x == 1) :
if(doorNum == doorInp) :
print("You opened the wrong door and died.")
exit()
現在
,如果我碰巧得到了不吉利的數字工作正常。
else :
print("You entered a room.")
doorNum = randint(1, 3)
這是完全停止響應的部分。我在bash交互式shell(Terminal,在osx上)運行它。它只是空白。
我是Python新手,我花了大部分時間作爲Web開發人員。
UPDATE:
感謝@rawing,我還不能給予好評(新手),這樣就會把它放在這裏。
爲什麼'while(x == 1)'循環? –
這是python2還是python3? –
@Rawing python3我想。 – Ember