Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- marks=[randint(0,10) for x in range(30) ]
- msg="Hello Hello words Hello, everybody is fine ?"
- shopping=["tomatoes", "bread", "chocolate", "caviar", "bread", "pizza", "bread"]
- def count_occurences(occurence,list_of_stuff):
- count=0
- for item in list_of_stuff:
- if item==occurence:
- count+=1
- print("{} appears {} times in the list".format(occurence,count))
- return count
- count_occurences(10,marks)
- count_occurences("H",msg)
- count_occurences("bread",shopping)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement