For this problem I’m supposed to generate a user input list with random integers between 1 and 10. Im then supposed to count the occurrences of each integer from 0-10 and print them.
I’m a beginner in code so I’ve been having trouble trying to do the occurrences part and have them print out like this for example
for user_input = 4 if the generated list is [3,5,7,8]
* Output:
0: 0
1: 0
2: 0
3: 1
4: 0
5: 1
6: 0
7: 1
8: 1
9: 0
10: 0
so far this is what I have written any help, references, or examples would help immensely!
import random
def main():
random_list = []
n = int(input('Enter list length: '))
for count in range(n):
number = random.randint(1, 10)
print(number)
main()