Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Average Function
- # Output formatted to 2 decimal places
- import random
- def average(data):
- total = 0
- count = 0
- for item in data:
- total = total + int(item)
- count += 1
- return (total/count)
- scores = []
- for x in range (0, 30):
- scores.append(random.randint(0, 10))
- print("Average mark = %.2f" % average(scores))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement