Advertisement
BbJLeB

05. Wedding Presents

May 30th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. # 5. Wedding Presents
  2.  
  3. guests = int(input())
  4. gift = int(input())
  5. all_gifts = 0
  6. money_gifts = 0             # A
  7. elec_gifts = 0              # B
  8. vaucher_gifts = 0           # V
  9. other_gifts = 0             # G
  10.  
  11. for i in range (gift):
  12.     meme = input()
  13.     if meme == "A":
  14.         money_gifts += 1
  15.     elif meme == "B":
  16.         elec_gifts += 1
  17.     elif meme == "V":
  18.         vaucher_gifts += 1
  19.     elif meme == "G":
  20.         other_gifts += 1
  21. procent_money = (money_gifts / gift) * 100
  22. procent_elec = (elec_gifts / gift) * 100
  23. procent_vaucher = (vaucher_gifts / gift) * 100
  24. procent_other = (other_gifts / gift) * 100
  25. average_gift = (gift / guests) * 100
  26. print(f"{procent_money:.2f}%")
  27. print(f"{procent_elec:.2f}%")
  28. print(f"{procent_vaucher:.2f}%")
  29. print(f"{procent_other:.2f}%")
  30. print(f"{average_gift:.2f}%")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement