Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- def count(target,scores):
- counter = 0 # Initialise a variable for counting scores of ten
- for score in scores:
- if score == target:
- counter += 1
- #print("{0} learners got top marks".format(counter))
- return counter
- scores = []
- text="Hello mates how are you doing this agoust"
- itemlist=['FCB','MC','MU','TOT','ATM', 'FCB', 'MUN']
- for x in range (0, 30):
- scores.append(randint(0, 10)) # Generate a random number from 0 to 10 and append to scores
- print(scores)
- print(" Num of 10",count(10,scores))
- print (text)
- print(" Num of a",count('a',text))
- print (itemlist)
- print(" Num of FCB",count('FCB',itemlist))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement