<div class="gmail_quote">On Thu, Jan 6, 2011 at 10:49 PM, francesco <span dir="ltr"><<a href="http://cerutti.francesco.to">cerutti.francesco.to</a>@<a href="http://gmail.com">gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I'm pretty new in Python language. I have a problem with numbers: it<br>
seems python doesn't know any more how to count!<br>
I get only the down rounded integer<br>
20/8 = 2<br>
8/3=2<br>
I probably changed some option to round the numbers, but I don't<br>
remember how.<br>
Is there a way to reset the number of digits to default?<br>
Thanks in advance<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br><div>Hi, the problem is that you've used two integers, which in turn return an integer. In order to get around your problem, try 20.0/8 - the 20.0 is a float, which will return a float. Have a read here - <a href="http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex">http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex</a><br>
<br>Might I also suggest that you use the <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><a href="mailto:tutor@python.org">tutor@python.org</a> mailing list for beginner questions - you'll get more help there. :)</span></div>