Good morning:
I made this code for an exercise. My question is: How can I optimize the outputs without having to make multiple prints. In that code I made for three outputs. Only if it was for 10 outputs I would have to make 10 prints. Another question I have. In the text "the value of the commission of the FIRST representative ..." ... this term ... first ... second ... third ... is there any way I can leave it automated without having to type one by one . Below is my code.
itens = []
item=0
valor_item = 50
for i in range(3):
item = int(input("\nQuantidade de itens do %dº representante: " % (i+1)))
itens.append(item)
comissoes = []
for item in itens:
comissao = (0.1*valor_item*item) if item <= 19 else \
(0.15*valor_item*item) if item >=20 and item<= 49 else \
(0.20*valor_item*item) if item >=50 and item <=74 else \
(0.25*valor_item*item)
comissoes.append(comissao)
print("\nValor da Comissão do do Primeiro Representante: R$ %5.2f% " %comissoes[0])
print("\nValor da Comissão do do Segundo Representante: R$ %5.2f% " %comissoes[1])
print("\nValor da Comissão do do Terceiro Representante: R$ %5.2f% " %comissoes[2])
Thank you for your attention