while ループと if を使用してサイコロ ゲームを作成しようとしています。私はこれを成功させましたが、数字4、6、または12が入力されていない場合、無効な選択を示し、diceChoiceを再度尋ねるようにゲームをプログラムする方法を理解しようとしています. 誰でも助けることができますか?
これまでのところ...
rollAgain = "Yes" or "yes" or "y"
while rollAgain == "Yes" or "yes" or "y":
diceChoice = input ("Which dice would you like to roll; 4 sided, 6, sided or 12 sided?")
if diceChoice == "4":
import random
print("You rolled a ", random.randint(1,4))
if diceChoice == "6":
import random
print("You rolled a ", random.randint(1,6))
if diceChoice == "12":
import random
print("You rolled a ", random.randint(1,12))
rollAgain = input ("Roll Again?")
print ("Thank you for playing")