我想爲我的侄子做一個骰子tosser,所以他可以玩沒有骰子的棋盤遊戲。即使我輸入了一個真實的條件,我也陷入了一個while循環。我試圖讓他選擇他想用的骰子,但是如果他選擇了一個錯誤的骰子,那麼它會要求他再次輸入。我的代碼是...卡在while循環
dice_select = input('Enter the amount of sides are on the dice you want to throw, either 4, 6, or 12: ')
while dice_select != 4 or dice_select != 6 or dice_select != 12:
dice_select = int(input('Sorry thats not quite right. Enter the amount of sides are on the dice you want to throw, either 4, 6, or 12: '))
如果我輸入4,6或12,那麼當它應該繼續時,它仍然使我進入循環。
條件可能是錯誤的唯一方法是如果'dice_select'等於4,6和12全部在同一時間。 –
重新閱讀你的狀況。評估它的價值,你尋求。當'dice_select'是'4'時會發生什麼? – njzk2