[Tutor] Difference between rounding off and typecasting to int
Alan Gauld
alan.gauld at btinternet.com
Sat Jan 2 10:17:43 EST 2016
On 02/01/16 14:33, Ratheesh kumar wrote:
> But I can't get to understand what round() did int() cant't do
With this kind of question its best to ask the interpreter:
>>> int(12.1)
12
>>> int(12.9)
12
>>> round(12.1)
12
>>> round(12.9)
13
>>>
Does that make it clearer?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list