Advertisement
miglenabs

Untitled

Nov 21st, 2022
528
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. total_count = int(input())
  2.  
  3. count_Hearthstone = 0
  4. count_Fornite = 0
  5. count_Overwatch = 0
  6. count_others = 0
  7. for n in range(0, total_count + 1):
  8.     name_game = str(input())
  9.     if name_game == "Hearthstone":
  10.         count_Hearthstone += 1
  11.     elif name_game == "Fornite":
  12.         count_Fornite += 1
  13.     elif name_game == "Overwatch":
  14.         count_Overwatch += 1
  15.     else:
  16.         count_others += 1
  17.  
  18. percent_Hearthstone = (count_Hearthstone / total_count) * 100
  19. percent_Fornite = (count_Fornite / total_count) * 100
  20. percent_Overwatch = (count_Overwatch / total_count) * 100
  21. percent_others = 100 - (percent_Hearthstone + percent_Fornite + percent_Overwatch)
  22.  
  23.  
  24. print(f"Hearthstone - {percent_Hearthstone:.2f}%")
  25. print(f"Fornite - {percent_Fornite:.2f}%")
  26. print(f"Overwatch - {percent_Overwatch:.2f}%")
  27. print(f"Others - {percent_others:.2f}%")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement