TypeError: 'float' object is not callable (finding averages of a list of numbers)
<pre><code>sales = [49.99, 20, 155.20, 71.65, 91.07]

length = len(sales)
max_value = max(sales)
min_value = min(sales)
sum_of_values = sum(sales)

print(length, max_value, min_value, sum_value)

average = float(sum_of_values/length)

answer = round(average,2)

print(answer)
</code></pre>

<p>I'm trying to get a sum of the numbers in the list and then find the average, round the average to 2 decimal places, and then print it. how would I fix this error?</p>

<p>Your code is working fine on my machine.</p>

<p>But as a suggestion:
In Python 3.4 the statistics module was introduced, which enables you to do</p>

<pre><code>&gt;&gt;&gt; from statistics import mean
&gt;&gt;&gt; mean([1, 2, 3, 4, 4])
2.8
&gt;&gt;&gt; mean([49.99, 20, 155.20, 71.65, 91.07])
77.582
</code></pre>

<p>For more infos refer to: <a href="https://docs.python.org/3/library/statistics.html#function-details" rel="nofollow">https://docs.python.org/3/library/statistics.html#function-details</a></p>

python