[SOLVED] Re: [web2py] Re: How to use the "insert" method of python list in web2py

2012-11-29 Thread Relsi Hur
I was so fixed in the string format, that I was ignoring the basic math! =/ Thanks to everyone for the tips!! This solve very well: "%i.%02i" % divmod(348,100) Em quinta-feira, 29 de novembro de 2012 09h12min39s UTC-2, Joe Barnhart escreveu: > > Bzzzt! Thanks for playing! > > You get 3.0

Re: [web2py] Re: How to use the "insert" method of python list in web2py

2012-11-29 Thread Joe Barnhart
Bzzzt! Thanks for playing! You get 3.0 for your result. (I'm not a python genius but I keep an interpreter handy just to type in stuff and see what I get.) >>> round(int("348")/100,3) 3.0 In your example, you rounded the result AFTER the integer division of 348/100. But the result of

Re: [web2py] Re: How to use the "insert" method of python list in web2py

2012-11-29 Thread Manuele Pesenti
Il 29/11/12 10:49, Joe Barnhart ha scritto: Hmmm... That would give "3" since Python 2.x keeps the calculation as integer (it won't coerce it to a float). He could do a=int(a)/100.0 But that puts it into a floating point value, and rounding sometimes gives surprising and unexpected results