Convert int to float

sturlamolden sturlamolden at yahoo.no
Sat Mar 15 23:11:44 CET 2008


On 15 Mar, 22:43, Guido van Brakel <guidovb1 at invalid> wrote:

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


gem( map(float,[1,2,3,4]) )

gem( float(i) for i in [1,2,3,4] )







More information about the Python-list mailing list