Advertisement
exDotaPro

9_march_2019_5_fitness_center

Jan 10th, 2020
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. visitors = int(input())
  2.  
  3. back_workout = 0
  4. chest_workout = 0
  5. legs_workout = 0
  6. abs_workout = 0
  7. protein_shake = 0
  8. protein_bar = 0
  9.  
  10. workout_visits = 0
  11. protein_bought = 0
  12.  
  13. for i in range(visitors):
  14.     activity = input()
  15.  
  16.     if activity == 'Back':
  17.         back_workout += 1
  18.         workout_visits += 1
  19.  
  20.     elif activity == 'Chest':
  21.         chest_workout += 1
  22.         workout_visits += 1
  23.  
  24.     elif activity == 'Legs':
  25.         legs_workout += 1
  26.         workout_visits += 1
  27.  
  28.     elif activity == 'Abs':
  29.         abs_workout += 1
  30.         workout_visits += 1
  31.  
  32.     elif activity == 'Protein shake':
  33.         protein_shake += 1
  34.         protein_bought += 1
  35.  
  36.     elif activity == 'Protein bar':
  37.         protein_bar += 1
  38.         protein_bought += 1
  39.  
  40. percentage_work_out_visitors = (workout_visits / visitors) * 100
  41. percentage_protein_buyers = 100 - percentage_work_out_visitors
  42.  
  43. print(f'{back_workout} - back')
  44. print(f'{chest_workout} - chest')
  45. print(f'{legs_workout} - legs')
  46. print(f'{abs_workout} - abs')
  47. print(f'{protein_shake} - protein shake')
  48. print(f'{protein_bar} - protein bar')
  49. print(f'{percentage_work_out_visitors:.2f}% - work out')
  50. print(f'{percentage_protein_buyers:.2f}% - protein')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement