Advertisement
simeonshopov

PC game shop

Oct 11th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. n = int(input())
  2. Hearthstone_counter = 0
  3. Fornite_counter = 0
  4. Overwatch_counter = 0
  5. Others_counter = 0
  6.  
  7. for i in range(n):
  8.   game = input()
  9.   if game == "Hearthstone":
  10.     Hearthstone_counter += 1
  11.   elif game == "Fornite":
  12.     Fornite_counter += 1
  13.   elif game == "Overwatch":
  14.     Overwatch_counter += 1
  15.   elif game not in ["Hearthstone", "Fornite", "Overwatch"]:
  16.     Others_counter += 1
  17.  
  18. print(f"Hearthstone - {((Hearthstone_counter / n) * 100):.2f}%")
  19. print(f"Fornite - {((Fornite_counter / n) * 100):.2f}%")
  20. print(f"Overwatch - {((Overwatch_counter / n) * 100):.2f}%")
  21. print(f"Others - {((Others_counter / n) * 100):.2f}%")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement