我正在尝试重新掷出多个骰子,并且每次都要记住上一次重新掷出的骰子。因此,例如,如果我掷出 5 个骰子并得到 1、2、3、4、5。我问你要重掷哪个骰子——1、3、4,然后得到类似 3、2、5、3、5 的东西。但正如我在循环中询问的那样,它会覆盖以前的新卷,只给出最后一个。在循环运行时如何存储新找到的数字?
reroll1 = input("Would you like to reroll? Yes or No: ")
if reroll1 == "Yes" or "yes":
count = 0
times = int(input("How many die would you like to reroll? "))
while count < times:
whichreroll = input("Reroll die: ")
if whichreroll == "1":
reroll1 = random.randint(1,6)
else:
reroll1 = die1
if whichreroll == "2":
reroll2 = random.randint(1,6)
else:
reroll2 = die2
if whichreroll == "3":
reroll3 = random.randint(1,6)
else:
reroll3 = die3
if whichreroll == "4":
reroll4 = random.randint(1,6)
else:
reroll4 = die4
if whichreroll == "5":
reroll5 = random.randint(1,6)
else:
reroll5 = die5
newset = [reroll1, reroll2, reroll3,reroll4,reroll5]
count += 1
print(newset)