Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- #function checks for given score and increases mark counter for eventual return after completion
- def mark_count(score_list, grade):
- mark = 0
- for score in score_list:
- if score == grade:
- mark += 1
- return mark
- #list stores randomly generated scores
- scores = []
- for x in range(0, 30):
- scores.append(randint(0,10))
- #Scores are printed and mark_count is called
- print(scores)
- grades = mark_count(scores, 5)
- print("{0} learners got input mark".format(grades))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement