Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- number_of_cargo = int(input())
- average_price = 0
- microbus = 0
- truck = 0
- train = 0
- total_weight = 0
- price = 0
- for cargo in range(number_of_cargo):
- weight = int(input())
- if weight <= 3:
- microbus += weight
- price += weight * 200
- elif weight <= 11:
- truck += weight
- price += weight * 175
- else:
- train += weight
- price += weight * 120
- total_weight += weight
- average_price = price / total_weight
- print(f'{average_price:.2f}')
- average_microbus = microbus / total_weight * 100
- print(f'{average_microbus:.2f}%')
- average_truck = truck / total_weight * 100
- print(f'{average_truck:.2f}%')
- average_train = train / total_weight * 100
- print(f'{average_train:.2f}%')
Advertisement
Add Comment
Please, Sign In to add comment