[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Convert int to float

Guido van Brakel

3/15/2008 9:51:00 PM

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
--