round numbers in an array without importing Numeric or Math?

Alexander Schmolck a.schmolck at gmail.com
Tue May 16 14:22:07 EDT 2006


Lance Hoffmeyer <lance at augustmail.com> writes:

> Is there an easy way to round numbers in an array?
> 
> I have
> Test = [1.1,2.2,3.7]
> 
> and want to round so the values are
> 
> print Test  [1,2,4]

[int(x+0.5) for x in Test]

'as



More information about the Python-list mailing list