Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. guests=int(input())
  2. gifts=int(input())
  3. kindA=0
  4. kindB=0
  5. kindV=0
  6. kindG=0
  7. for i in range(gifts):
  8.     kind=input()
  9.     if(kind=='A'):
  10.         kindA+=1
  11.     elif(kind=='B'):
  12.         kindB+=1
  13.     elif(kind=='V'):
  14.         kindV+=1
  15.     elif(kind=='G'):
  16.         kindG+=1
  17.  
  18. perA=kindA/gifts*100
  19. perB=kindB/gifts*100
  20. perV=kindV/gifts*100
  21. perG=kindG/gifts*100
  22.  
  23. perWhole=gifts/guests*100
  24.  
  25. print(f'{perA:.2f}%')
  26. print(f'{perB:.2f}%')
  27. print(f'{perV:.2f}%')
  28. print(f'{perG:.2f}%')
  29. print(f'{perWhole:.2f}%')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement