I am trying to create a function that every time it is called, generate a list of 100 random launches of a die using the random library.
import random
def dice():
dado = []
for i in range(100):
dado.append(random.choice(range(1,7)))
return dado
dice()
When I run the function, it only returns a value to me. On the other hand, when I do this:
def dice():
dado = []
for i in range(100):
dado.append(random.choice(range(1,7)))
print(dado)
It returns 100 lists to me. The first contains a number, the next two, and so on until the 100 list is printed with 100 numbers. As I pointed out, what I want is for a single list of 100 random numbers to be printed.
I want to point out that I am also interested in the fact that the resulting list can be plotted through a histogram, for example.
Any help or guidance is very much appreciated. Thanks!