Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- #takes the score list and a vowel list to check from and returns the number of vowels (mark)
- def mark_count(score_list, vowel_list):
- mark = 0
- for score in score_list:
- for letter in vowel_list:
- if score == letter:
- mark += 1
- return mark
- #scores will store random letters, alphabet is the source of all possible letters, and vowels is the list to reference from
- scores = []
- vowels = "aeiou"
- alphabet = "abcdefghijklmnopqrstuvwxyz"
- #randomly generate vowels by using an integer from 0-25 as an index for the alphabet list
- for x in range(0, 30):
- chance = randint(0, 25)
- scores.append(alphabet[chance])
- #finish program by printing random list and calling mark_count function
- print(scores)
- grades = mark_count(scores, vowels)
- print("{0} learners got input mark".format(grades))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement