CALCULATE PERCENTAGE OF SELLERS

Asked

Viewed 58 times

-3

THE QUESTION THAT CALLS FOR THE FOLLOWING:

1st proposal: Prepare arrangements (indexed variables) of, at most, 10 positions. Receive the name, registration and total sales, calculate the respective commission (10% of sales) of each seller for as many users as desired. Present at the end: a) The name, registration, total sales and the respective commission of each seller; b) The total sum of sales; c) The value of the highest commission and the lowest commission; d) The data of the seller(s) of highest commission; e) The data of the seller(s) of lowest commission.

**ALGORITHM I PROPOSED **

1º Receber o nome, a matrícula e o total de vendas

2º calculate the respective commission (10% of sales) of each seller for as many users as desired.

3rd Present at the end: a) The name, registration, total sales and respective commission of each seller

The total sum of sales

The value of the highest commission and the lowest commission

6º The data of the seller(s) (s) of higher commission and lower commission

I COULD DO THAT

Nomes = []
Matriculas = []
totalVendas = []
for i in range(0,3):
addNomes = input(f'Nome do {i+1}º funcionario: ').capitalize()
Nomes.append(addNomes)

addMatriculas = input('Número de matrícula: ')
Matriculas.append(addMatriculas)

addTotalVendas = input('Total de vendas: ')
totalVendas.append(int(addTotalVendas))

1 answer

0


I used your code and added the items of the question that were missing and commented on some parts of the code for a good view

Follows the code:

Nomes = []
Matriculas = []
totalVendas = []
comissoes = []

for i in range(0, 10):
    comissaoVendas = 0.1

    addNomes = input(f'Nome do {i+1}º funcionario: ').capitalize()
    Nomes.append(addNomes)

    addMatriculas = input('Número de matrícula: ')
    Matriculas.append(addMatriculas)

    addTotalVendas = input('Total de vendas: ')
    totalVendas.append(int(addTotalVendas))

    comissoes.append(float(addTotalVendas) * comissaoVendas)


# a) O nome, a matrícula, o total de vendas e a respectiva comissão de cada vendedor;
for i in range(0, 10):
    print("\n--- " + str(i+1) + "º funcionario ---")
    print("Nome: " + Nomes[i])
    print("Matricula: " + Matriculas[i])
    print("Total de vendas: " + str(totalVendas[i]))
    print("Comissão: " + str(comissoes[i]))

# b) A soma total das vendas;
print("\nSoma total das vendas: " + str(sum(totalVendas)))

# c) O valor da maior comissão e da menor comissão;
print("O maior valor da comissão: " + str(max(comissoes)) + "\nO menor valor da comissão: " + str(min(comissoes)))

# d) Os dados do(s) vendedor(es) de maior comissão;
maiorcomissao = float(max(comissoes))
posicaomaior = comissoes.index(maiorcomissao)
print("\nDados do(s) vendedor(es) de maior comissão")
print("Nome: " + Nomes[posicaomaior])
print("Matricula: " + Matriculas[posicaomaior])
print("Total de vendas: " + str(totalVendas[posicaomaior]))
print("Comissão: " + str(comissoes[posicaomaior]))


# e) Os dados do(s) vendedor(es) de menor comissão.
menorcomissao = float(min(comissoes))
posicaomenor = comissoes.index(menorcomissao)
print("\nDados do(s) vendedor(es) de menor comissão")
print("Nome: " + Nomes[posicaomenor])
print("Matricula: " + Matriculas[posicaomenor])
print("Total de vendas: " + str(totalVendas[posicaomenor]))
print("Comissão: " + str(comissoes[posicaomenor]))
  • Mano pqp ein, very real obg :0 :) tested the code and worked perfectly, I will study it

  • 1

    The Goal of Stack Overflow is not doing exercises or the users' homework. Stack Overflow is a Q&A site for professional programmers and enthusiasts. where questions should be practical (or conceptual with practical application), detailed and with a specific focus. Aside from the fact that doing another’s exercises doesn’t help you.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.