In: Computer Science
In Python, generate 30 random values between 0-10 and store it in a list. Print the list and the number of occurrences for each value from 0 to 10.
RAW CODE
import random
random_list = [random.randint(0,10) for _ in range(30)] ## generating random numbers from 0-10
print(random_list) ## Printing list
for i in range(11):
### list.count(x) counts the occurance of x in list
print("Count of {} is".format(i),random_list.count(i)) ## format append data in list during run time
SCREENSHOT (CODE AND OUTPUT)
##### FOR ANY QUERY, KINDLY GET BACK, THANKYOU. #####