Print Highest, Average, Lowest score of a file
<p>I'm trying to print the highest, average, and lowest score of a file in python. But I keep getting error </p>

<pre><code>ValueError: invalid literal for int() with base 10.
</code></pre>

<p>My <em>results.txt</em> file looks like this:</p>

<pre><code>Johnny-8.65
Juan-9.12
Joseph-8.45
Stacey-7.81
Aideen-8.05
Zack-7.21
Aaron-8.31
</code></pre>

<p>And my code looks like this</p>

<pre><code>func1={}
with open('results.txt','r') as f:
    for line in f:
        name,value=line.split('-')
        value=float(value)
        if name in func1.keys():
           func1[name].append(value)
        else:
            func1[name]=[value]

#compute average: 
for name in func1:

    average=sum(func1[name])/len(func1[name])
    print("{} : {}".format(name,average))
</code></pre>

<p>As everyone on this thread suggested you should change <strong>int</strong> to <strong>float</strong>. Regarding your comment above. You use </p>

<pre><code>value=int(float) ! 
</code></pre>

<p>Float should be outside parentheses. Like this </p>

<pre><code>value=float(value).
</code></pre>

<p>I run the code and it worked for me.</p>

python max average data-type-conversion min