0
Most efficient way to store dice rolls?
roll_d6 = random.randint(1,6) What is the most efficient way to store the result of each roll for x amount of rolls? Thanks!
2 Respuestas
+ 7
import random
dice = []
for throws in range(10):
dice += [random.randint(1,6)]
print(dice)
+ 4
You could store it in an array, so something like this:
rolls = [0, 0, 0, 0, 0, 0]
roll_d6 = random.randint(1, 6)
rolls[roll_d6]++