Advertisement
Jorell_Ramos_Sinaga

Untitled

Dec 19th, 2021
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. n=int(input())
  2. C=0
  3. R=0
  4. S=0
  5. for i in range(n):
  6. a,ch=list(map(str,input().split()))
  7. a=int(a)
  8. if(ch == 'C'):
  9. C += a
  10. elif (ch == 'R'):
  11. R += a
  12. else:
  13. S += a
  14. total=C+R+S
  15. x=(C*100.00)/total
  16. y=(R*100.00)/total
  17. z=(S*100.00)/total
  18. print("Total: {} cobaias".format(total))
  19. print("Total de coelhos:",C)
  20. print("Total de ratos:",R)
  21. print("Total de sapos:",S)
  22. print("Percentual de coelhos: %.2lf %%"%x)
  23. print("Percentual de ratos: %.2lf %%"%y)
  24. print("Percentual de sapos: %.2lf %%"%z)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement