Convert int to float

Grant Edwards grante at visi.com
Sat Mar 15 17:45:27 EDT 2008


On 2008-03-15, Guido van Brakel <guidovb1 at invalid> wrote:
> Hello
>
> I have this now:
>
>> def gem(a):
>>     g = sum(a) / len(a)

       g = float(sum(a)) / len(a)

>>     return g

> It now gives a int, but i would like to see floats. How can integrate 
> that into the function?

See above.

> Life is like a box of chocolates, you never know what you're gonna get

  sometimes it's a crunchy frog...

-- 
Grant




More information about the Python-list mailing list