Convert int to float

Guido van Brakel guidovb1 at invalid
Sat Mar 15 17:50:45 EDT 2008


Hello

I have this now:

 > def gem(a):
 >     g = sum(a) / len(a)
 >     return g
 >     print gem([1,2,3,4])
 > print gem([1,10,100,1000])
 > print gem([1,-2,3,-4,5])


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

Regards,

-- 
Guido van Brakel
Life is like a box of chocolates, you never know what you're gonna get
-- 



More information about the Python-list mailing list