Advertisement
exDotaPro

2019_6_july_5_pc_game_shop

Feb 1st, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. games_count = int(input())
  2.  
  3. hearthstone = 0
  4. fornite = 0
  5. overwatch = 0
  6. others = 0
  7. all_games = 0
  8.  
  9. for games in range(games_count):
  10.     game_name = input()
  11.     all_games += 1
  12.  
  13.     if game_name == 'Hearthstone':
  14.         hearthstone += 1
  15.     elif game_name == 'Fornite':
  16.         fornite += 1
  17.     elif game_name == 'Overwatch':
  18.         overwatch += 1
  19.     else:
  20.         others += 1
  21.  
  22. hearthstone_percentage = (hearthstone / all_games) * 100
  23. fornite_percentage = (fornite / all_games) * 100
  24. overwatch_percentage = (overwatch / all_games) * 100
  25. others_percentage = (others / all_games) * 100
  26.  
  27. print(f'Hearthstone - {hearthstone_percentage:.2f}%')
  28. print(f'Fornite - {fornite_percentage:.2f}%')
  29. print(f'Overwatch - {overwatch_percentage:.2f}%')
  30. print(f'Others - {others_percentage:.2f}%')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement