Lyubohd

04. PC Game Shop

Jun 19th, 2021
735
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input())
  2.  
  3. hearthstone_cnt = 0
  4. fornite_cnt = 0
  5. overwatch_cnt = 0
  6. other_cnt = 0
  7.  
  8. for i in range(n):
  9.     current_game = input()
  10.     if current_game == "Hearthstone":
  11.         hearthstone_cnt += 1
  12.     elif current_game == "Fornite":
  13.         fornite_cnt += 1
  14.     elif current_game == "Overwatch":
  15.         overwatch_cnt += 1
  16.     else:
  17.         other_cnt += 1
  18.  
  19. hearthstone_percent = hearthstone_cnt / n * 100
  20. print(f"Hearthstone - {hearthstone_percent:.2f}%")
  21.  
  22. fornite_percent = fornite_cnt / n * 100
  23. print(f"Fornite - {fornite_percent:.2f}%")
  24.  
  25. overwatch_percent = overwatch_cnt / n * 100
  26. print(f"Overwatch - {overwatch_percent:.2f}%")
  27.  
  28. other_games_percent = other_cnt / n * 100
  29. print(f"Others - {other_games_percent:.2f}%")
  30.  
RAW Paste Data