Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
647 B
2
Indexable
Never
def formacaoDeTime(pontuacao, tamanho_do_time, k):
    # Write your code here
    a=[]
    b=[]
    while len(b)!= tamanho_do_time:
        for i in pontuacao:
                if i in pontuacao[0:k]:
                    a.append(i)    
        for i in pontuacao:
                if i in pontuacao[-k:(len(pontuacao))]:
                    a.append(i)
        c = max(a)
        b.append(c)
        for i in pontuacao:
            if i==c:
                pontuacao.remove((i))
        a.clear()
    print(b)

#como formatar a entrada formacaoDeTime(9,17,12,10,2,7,2,11,20,5,,3,4) transformando para formacaoDeTime([17,12,10,2,7,2,11,20,5],3,4)