Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mport matplotlib.pyplot as plot
- from random import randint
- scores = []
- test_result = []
- def count(num,scores):
- number = num
- count = 0
- for i in scores:
- if(i == number):
- count += 1
- return count
- for x in range (0, 30):
- scores.append(randint(0, 10)) # Generate a random number from 0 to 10 and append to scores
- print("Result of scores : {0}".format(scores)) # Print result and list of scores
- counter = 0
- for j in range(11):
- test_result.append(count(counter,scores))
- counter+= 1
- print("Learners got top marks : {0}".format(test_result)) # Print result and list of learners
- plot.bar(range(11), test_result, align='center', alpha=0.5)
- plot.xticks(range(11))
- plot.ylabel('Number of learners')
- plot.title('Test result')
- plot.show()
- plot.savefig(fname="Quiz Chart.png")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement