dimanche 21 octobre 2018

How do I generate 1000 random numbers between 0 and 20? [on hold]

Write a program to generate 1000 random numbers between 0 and 20 inclusive. Print a table giving a count for the number of times each number (between 0 and 20 inclusive) occurred. On one run, the following was the output.

It has to look something like this:

0 occurred 54 times

1 occurred 53 times

2 occurred 41 times

3 occurred 49 times...

20 occurred 56 times

I'm new to python so I'm having trouble with random numbers and loops.




Aucun commentaire:

Enregistrer un commentaire