Advertisement
Guest User

mean, min, max

a guest
Jun 17th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. from random import randint
  2. from statistics import mean
  3.  
  4. #Create list to capture time of walks.
  5. time_of_walks = []
  6.  
  7. #Use randint function to simulate time of walks for the week.
  8. for i in range(0,7):
  9. time_of_walks.append(randint(30,90))
  10. print(time_of_walks)
  11.  
  12. #Compute average
  13. print("My average walking time for the week is" + mean(time_of_walks) + " minutes.")
  14.  
  15. #Compute shortest walk.
  16. print("My shortest walk is " + str(min(time_of_walks)) + " minutes.")
  17.  
  18. #Compute longest walk.
  19. print("My longest walk is " + str(max(time_of_walks)) + " minutes.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement