Yesterday I was shocked, SHOCKED, to discover that round() is
occasionally rounding incorrectly. For example,
>>> print round(0.19945,4)
0.1994
For rounding of random samples of numbers between 0 and 1 ending in
'45', the error ratio is about 0.041. Here are a few more examples:
>>> print ro
ammar azif wrote:
> Hi,
>
> Thanks for the help guys.
>
>
> I have tried gui programming using Tkinter and use the Button class
> which accepts the command argument which is a function object.
>
> The question is how to send arguments if the function accepts arguments.
A common way to do this
Dick Moores wrote:
> Yesterday I was shocked, SHOCKED, to discover that round() is
> occasionally rounding incorrectly. For example,
>
> >>> print round(0.19945,4)
> 0.1994
>
> For rounding of random samples of numbers between 0 and 1 ending in
> '45', the error ratio is about 0.041. Here are
On Mon, Mar 19, 2007 at 03:04:03AM -0700, Dick Moores wrote:
> Yesterday I was shocked, SHOCKED, to discover that round() is
> occasionally rounding incorrectly. For example,
"Garbage In, Garbage Out" :-)
Floating point numbers in Python (and other computer languages) are only
an approximation:
At 03:29 AM 3/19/2007, Kent Johnson wrote:
>Dick Moores wrote:
>>Yesterday I was shocked, SHOCKED, to discover that round() is
>>occasionally rounding incorrectly. For example,
>> >>> print round(0.19945,4)
>>0.1994
>>For rounding of random samples of numbers between 0 and 1 ending in
>>'45', th
ammar azif wrote:
> Hi,
>
> Thanks for answering .. btw what do you mean by explicit , helper
> function? Can you explain about these functions?
I just mean, define an ordinary function of no arguments that does what
you want. For example, the calculator program I linked to has this Button:
tk.
Dick Moores wrote:
> Kent, I did understand the points you made in that earlier thread.
> However, I'm unhappy with
>
> >>> print round(0.19945,4)
> 0.1994
>
> Am I the only one unhappy with this kind of rounding?
IMO you are chasing a non-problem. In real-world use, you would probably
not t
Hi,
I need to generate a table with different x,y,z values and write them to a
file:
10.171 -15.243 -2.558
9.837 -14.511 -1.923
-23.451 -13.870 51.507
I would like to write to the files as columns
10.171 -15.243 -2.558
9.837 -14.511 -1.923
-23.451 -13.870 51.507
0.233 0.453
On Mon, Mar 19, 2007 at 01:11:27PM +0100, Per Jr. Greisen wrote:
> Hi,
> I need to generate a table with different x,y,z values and write them to a
> file:
> 10.171 -15.243 -2.558
> 9.837 -14.511 -1.923
> -23.451 -13.870 51.507
>
> I would like to write to the files as columns
> 10.171 -15.24
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Luke Paireepinart
> Sent: Friday, March 16, 2007 8:31 PM
> To: Tim Johnson
> Cc: tutor@python.org
> Subject: Re: [Tutor] cookie expiration date format
>
> Tim Johnson wrote:
> > Hi:
> > I want to be
Dave Kuhlman wrote:
> Try ljust and rjust. They are string functions/methods and are
> described here: http://docs.python.org/lib/string-methods.html
>
> Something like the following might work for you:
>
> In [1]: value = 3.45678
> In [2]: ("%0.3f" % value).rjust(10)
> Out[2]: '
Thanks very much for your help.
I did indeed neglect to put the "print" in the code that I sent to the
list.
It appears that the step that is taking a long time, and that therefore
makes me think that the script is somehow broken, is creating a
dictionary of frequencies from the list of ngrams. T
On Monday 19 March 2007 15:33, Mike Hansen wrote:
> Some of the modules in the Python standard library make things a little
> more difficult than other languages.(Perl, Ruby, ...) This is a good
> example of it. Are there any 3rd party modules that let you set the
> expiration date to 'yesterda
Switanek, Nick wrote:
> Thanks very much for your help.
>
> I did indeed neglect to put the "print" in the code that I sent to the
> list.
>
> It appears that the step that is taking a long time, and that therefore
> makes me think that the script is somehow broken, is creating a
> dictionary of
Switanek, Nick wrote:
> Great, Kent, thanks. I thought that I had to check in the .keys() to see
> if the key was there.
>
> It seems that the method you suggest will not work if I'm looking for a
> value in the dictionary. If that's correct, is there a fast alternative
> to searching through .va
On Mon, Mar 19, 2007 at 03:04:03AM -0700, Dick Moores wrote:
> Yesterday I was shocked, SHOCKED, to discover that round() is
> occasionally rounding incorrectly. For example,
>
> >>> print round(0.19945,4)
> 0.1994
.
.
.
> Comments, Tutors? Am I way out in left field with this?
I suggest you m
> -Original Message-
> Date: Mon, 19 Mar 2007 11:53:06 -0400
> From: Kent Johnson <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] Making table
> To: tutor@python.org
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Dave Kuhlman wrote:
> > Try l
On 3/19/07, Switanek, Nick <[EMAIL PROTECTED]> wrote:
> Thanks very much for your help.
>
> It appears that the step that is taking a long time, and that therefore
> makes me think that the script is somehow broken, is creating a
> dictionary of frequencies from the list of ngrams. To do this, I've
Carroll, Barry wrote:
>> -Original Message-
>> Date: Mon, 19 Mar 2007 11:53:06 -0400
>> From: Kent Johnson <[EMAIL PROTECTED]>
>> Most string formatting conversions allow you to specify a width
>> directly. For example,
>> In [61]: value = 3.45678
>> In [63]: "%10.3f" % value
>> Out[63]: '
> -Original Message-
> From: Kent Johnson [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 19, 2007 12:59 PM
> To: Carroll, Barry
> Cc: tutor@python.org
> Subject: Re: [Tutor] Making table
>
> Carroll, Barry wrote:
> >> -Original Message-
> >> Date: Mon, 19 Mar 2007 11:53:06 -0400
>
20 matches
Mail list logo