Advertisement
Fareehausman00

Untitled

Sep 21st, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #Counts scores in range e.g. 0 to 3
  2.  
  3. import random
  4.  
  5. count = 0
  6.  
  7. def count_scores(lst, mini, maxi):
  8. global count
  9. for num in lst:
  10. if num >= mini and num <= maxi:
  11. count += 1
  12. print(count)
  13.  
  14. scores = []
  15.  
  16. for x in range (0, 30):
  17. scores.append(random.randint(0, 10))
  18.  
  19. print(scores)
  20.  
  21. top_scorers = count_scores(scores, 0, 3) # count_scores function called here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement