Advertisement
Kaloyankerr

Logistic

Oct 17th, 2019
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1.  
  2. n = int(input())
  3. bus = 0
  4. truck = 0
  5. train = 0
  6. average = 0
  7. total_tons = 0
  8.  
  9. for i in range(n):
  10. tons = int(input())
  11.  
  12. if tons <= 3:
  13. bus += tons
  14.  
  15. elif tons >= 4 and tons <= 11:
  16. truck += tons
  17.  
  18. elif tons >= 12:
  19. train += tons
  20.  
  21. total_tons = bus + truck + train
  22. average = (bus * 200 + truck * 175 + train * 125) / total_tons
  23.  
  24. bus_percent = (bus / total_tons) * 100
  25. truck_percent = (truck / total_tons) * 100
  26. train_percent = (train / total_tons) * 100
  27.  
  28. print(f'{average:.2f}')
  29. print(f'{bus_percent:.2f}%')
  30. print(f'{truck_percent:.2f}%')
  31. print(f'{train_percent:.2f}%')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement