(Jul-31-2019, 01:42 AM)ichabod801 Wrote: First...
I don't understand how you're using num in
for num in range(1000): counts[random.randint(1, 10)] += 1Num doesn't appear in the indented line.
(Jul-31-2019, 03:22 AM)scidam Wrote: Did you consider usingnumpy
to solve this problem? if you use numpy, you can easily generate array of random numbers and then count each number, something like this:
from collections import Counter import numpy as np Counter(np.random.randint(0, 10, 1000))
Thanks, my data-scientist friend told me about that. I just wanted to see if I could do it without importing any more modules.