"None" instead of [1,1,1,1]

0

I'm doing a problem that works like this: For example, suppose a team of 4 telemarketers should make 6 calls, whose times are 5, 2, 3, 3, 4, 9. As initially no salesperson is busy , the first seller will make the 5-minute call, the second-seller the 2-minute call, and the 3-and-4-number sellers will make 3-minute calls. As the second seller will terminate your call before the others, he will make the fifth call, 4 minutes, and finally, the third seller (whose time is the same as the fourth seller, but his sixth call, 9 minutes.

The function has to return a list with the number of links that each salesperson made. In the above example, you would have to return [1,2,2,1].

My code is currently only evaluating whether the number of sellers is equal to the number of connections or higher. However, I am printing an example where this number is equal, and it is returning "None" instead of [1,1,1,1].

def ligacoes(n,l):
"Retorna uma lista que contem quantas ligacoes cada vendedor fara, seguindo as regras"
resultado = []
#v = numero de identificacao dos vendedores
    if n == len(l):
        for n in range(len(l)):
            resultado = resultado + [1]
    if n > len(l):
        for n in range(len(l)):
            resultado = resultado + [1]
        resultado = resultado + [0]

print ligacoes(4,[3,3,4,5])
    
asked by anonymous 06.05.2018 / 16:23

0 answers