title: Python: list function and lambda expressions
body: <p>So I need to make a function that sums the squares of the numbers up until n, using only a return.</p>
  
  <p>I've tried:</p>
  
  <pre><code>    from functools import reduce
  
      def soma_quadrados(n):
          return sum(list(reduce(lambda x: x**2, list(range(1,n+1)))))
  </code></pre>
  
  <p>Which gives the error:<code>lambda () takes 1 positional argument but 2 were given</code></p>
  
  <p>I've also tried </p>
  
  <pre><code>    return sum(list(reduce(lambda x: x**2, n)))
  </code></pre>
  
  <p>Which gives the error: <code>reduce() arg 2 must support iteration</code></p>
  
  <p>What should I do?
  Thanks in advance</p>