Advertisement
ssoni

workout.py

Feb 24th, 2025
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import random
  2.  
  3. def main():
  4. mins = int(input('How long do you intend to workout? '))
  5. genWorkout(mins)
  6.  
  7. def genWorkout(t):
  8. exercises = ['JJax','SitUps','Pushups','Crunches','Squats','Burpees']
  9. i=0
  10. while (t>0):
  11. if t<5:
  12. duration = random.randint(1,t)
  13. else:
  14. duration = random.randint(1,5)
  15.  
  16. if exercises[i] == 'Burpees':
  17. duration = 1
  18.  
  19. t = t - duration
  20.  
  21. print(f'Do {duration} mins of {exercises[i]}')
  22. i=i+1
  23.  
  24. #in case you run out of exercises, cycle back to exercise[0]
  25. if i>len(exercises)-1:
  26. i=0
  27.  
  28. main()
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement