0
Good morning:
I made this code for an exercise. My question is: How can I optimize the outputs without having to do multiple prints. In this code I made for three exits. Only if it was for 10 exits I would have to do 10 prints.Another question I have. In the text "the value of the commission of the FIRST representative..."...this term...first...second...third...has some way I leave it automated without I have to type one by one. Below follows 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])
Grateful for the attention
Gosh. Thank you. You helped a lot.
– Rodrigo Ferraz