DerioFT

1094.py

Oct 26th, 2021
490
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. N = int(input())
  2.  
  3. Coelho = 0
  4. Rato = 0
  5. Sapo = 0
  6.  
  7. for data in range(N):
  8.  
  9.     input_data = str(input())
  10.  
  11.     split = input_data.split()
  12.  
  13.     number = int(split[0])
  14.     letter = str(split[1])
  15.  
  16.     if letter == "C":
  17.         Coelho += number
  18.  
  19.     elif letter == 'R':
  20.         Rato += number
  21.  
  22.     elif letter == 'S':
  23.         Sapo += number
  24.  
  25. total = Coelho + Rato + Sapo
  26.  
  27. average_coelho = (Coelho / total) * 100
  28. average_rato = (Rato / total) * 100
  29. average_sapo = (Sapo / total) * 100
  30.  
  31. print("Total:",total,"cobaias")
  32. print("Total de coelhos:", Coelho)
  33. print("Total de ratos:", Rato)
  34. print("Total de sapos:", Sapo)
  35. print("Percentual de coelhos: %0.2f" % average_coelho, "%")
  36. print("Percentual de ratos: %0.2f" % average_rato, "%")
  37. print("Percentual de sapos: %0.2f" % average_sapo, "%")
  38.  
  39. '''
  40. N = int(input())
  41.  
  42. Coelho = 0
  43. Rato = 0
  44. Sapo = 0
  45.  
  46. for data in range(N):
  47.  
  48.     input_data = str(input())
  49.  
  50.     split = input_data.split()
  51.  
  52.     number = int(split[0])
  53.     letter = str(split[1])
  54.  
  55.     if letter == "C":
  56.         Coelho += number
  57.  
  58.     elif letter == 'R':
  59.         Rato += number
  60.  
  61.     elif letter == 'S':
  62.         Sapo += number
  63.  
  64. total = Coelho + Rato + Sapo
  65.  
  66. average_coelho = (Coelho / total) * 100
  67. average_rato = (Rato / total) * 100
  68. average_sapo = (Sapo / total) * 100
  69.  
  70. print("Total:",total,"cobaias"
  71.     "\nTotal de coelhos:", Coelho,
  72.     "\nTotal de ratos:", Rato,
  73.     "\nTotal de sapos:", Sapo,
  74.     "\nPercentual de coelhos: %0.2f" % average_coelho, "%",
  75.     "\nPercentual de ratos: %0.2f" % average_rato, "%",
  76.     "\nPercentual de sapos: %0.2f" % average_sapo, "%")
  77. '''
RAW Paste Data