Above average · Acima da média
Above average
Two loops, one after the other: the first works out the average, the second keeps the numbers above it.
This joins two patterns you have already used, the running total and the filter. Solving a problem in stages like this is how most longer programs are built.
Acima da média
Dois loops, um após o outro: o primeiro calcula a média, o segundo mantém os números acima dela.
Isso une dois padrões já utilizados, o total acumulado e o filtro. Resolver um problema em etapas assim é como a maioria dos programas mais longos é construída.
Write above_average(nums) that returns a list of the numbers greater than the average of nums, in their original order. The list is never empty. · Escreva above_average(nums) que retorne uma lista dos números maiores que a média de nums, em sua ordem original. A lista nunca está vazia.
Click Run to see the output here. · Clique em Executar para ver a saída aqui.