Re: [Tutor] A better way to estimate the value of Pi?

2011-10-17 Thread Sagar Shankar
Hi Steven, > Can I ask you to please post code using plain text rather than HTML > email (also known as "rich text"), as HTML email messes up the > formatting? In this case, I can reverse-engineer the correct formatting, > so no harm done other than a waste of time, but that won't always be so > e

Re: [Tutor] Keyboard Module

2011-10-17 Thread Ryan Strunk
> So use raw wx key events. They include key down,up and press events. I'll give this a shot. Thank you. > Bloated carries the connotation of unnecessary code, but pygame provides a lot of functionality. You may not need it all, and using pygame may require you to import more than you need. But

Re: [Tutor] (no subject)

2011-10-17 Thread Nick Zarr
I think this was already mentioned in the replies to your other post: from random import sample base = int(input("Enter the bottom of the range? ")) upper = int(input("Enter the upper limit of your range: ")) quantity = int(input("How many numbers do you want to select: ")) sample(range(base, up

[Tutor] (no subject)

2011-10-17 Thread ADRIAN KELLY
Hello world, can anyone tell me how i can perfect the program below. it works find (prints 6 random numbers within a range) but on occasions the numbers are repeated. Thanks so much everyone #program that will allow the user to generate random numbers #from a range that they select. impor

Re: [Tutor] Jython for mutlithreading and on multicore system

2011-10-17 Thread Wayne Werner
On Mon, Oct 17, 2011 at 11:13 AM, Ashish Gaonker wrote: > Does Jython improve GIL issues of python by using JVM based threads? > Will code work faster on Jython then CPython? Can anybody help me to > understand this? You can use the multiprocessing module ( http://docs.python.org/library/multipr

[Tutor] FW: 6 random numbers(again)

2011-10-17 Thread ADRIAN KELLY
> Subject: Re: [Tutor] 6 random numbers > From: shanta...@gmail.com > Date: Mon, 17 Oct 2011 01:53:18 +0530 > CC: tutor@python.org > To: kellyadr...@hotmail.com > > On 17-Oct-2011, at 1:13 AM, ADRIAN KELLY wrote: > > > hello all, > > anyone know how i would go about printing 6 random n

Re: [Tutor] Jython for mutlithreading and on multicore system

2011-10-17 Thread Alan Gauld
On 17/10/11 17:13, Ashish Gaonker wrote: Does Jython improve GIL issues of python by using JVM based threads? Will code work faster on Jython then CPython? Can anybody help me to understand this? Speaking personally I've always fond CPython to be faster than equivalent code in Jython. But that

Re: [Tutor] A better way to estimate the value of Pi?

2011-10-17 Thread Steven D'Aprano
bob gailer wrote: It is not crucial here - but you must recognize that your program uses floating point numbers, which almost always are an approximation to the "real" value. For example (assuming decimal numbers): >>> 4/3.0 1. (followed by an unending number of 0's). Actu

Re: [Tutor] A better way to estimate the value of Pi?

2011-10-17 Thread Dave Angel
On 10/17/2011 11:55 AM, Sagar Shankar wrote: The "real" value of 4/3.0 is 1 followed by an unending number of 3's. Each successive fraction's floating point value will be "off" by some relatively small value. Those errors will probably add up. Another limitation of floating point numbers is

[Tutor] Jython for mutlithreading and on multicore system

2011-10-17 Thread Ashish Gaonker
Does Jython improve GIL issues of python by using JVM based threads? Will code work faster on Jython then CPython? Can anybody help me to understand this? -- Thanks & Regards Ashish Gaonker ___ Tutor maillist - Tutor@python.org To unsubscribe or chang

Re: [Tutor] A better way to estimate the value of Pi?

2011-10-17 Thread Steven D'Aprano
Sagar Shankar wrote: Hi Bob, I did use floating point numbers by using 4.0/1.0 - 4.0/3.0 etc., though I did not declare it explicitly. Do you think it's better form/practice to explicitly declare it? Python doesn't use type declarations. 4.0 is already explicitly a float, there's no need to d

Re: [Tutor] A better way to estimate the value of Pi?

2011-10-17 Thread Sagar Shankar
Hi Bob, I did use floating point numbers by using 4.0/1.0 - 4.0/3.0 etc., though I did not declare it explicitly. Do you think it's better form/practice to explicitly declare it? Regards, Sagar On Mon, Oct 17, 2011 at 9:10 PM, bob gailer wrote: > On 10/17/2011 6:31 AM, Sagar Shankar wrote: >

Re: [Tutor] A better way to estimate the value of Pi?

2011-10-17 Thread bob gailer
On 10/17/2011 6:31 AM, Sagar Shankar wrote: Hi, this is my first question to this group. I'm a beginner to computer science and programming in Python. Am currently using John Zelle's book - Python Programming: An introduction to computer science to teach myself.

Re: [Tutor] 6 random numbers

2011-10-17 Thread Robert Sjoblom
>     print random.randrange(1,42) > If you want to collect the intermediate results, either store them in a > list: > > results = [] > for i in range(6): >     results.append(random.randrange(1,42)) Gmail has removed the "Reply All" function for some ABSOLUTELY RIDICULOUS REASON, so I think peopl

Re: [Tutor] A better way to estimate the value of Pi?

2011-10-17 Thread Steven D'Aprano
Sagar Shankar wrote: Hi, this is my first question to this group. I'm a beginner to computer science and programming in Python. Am currently using John Zelle's book - Python Programming: An introduction to computer science to teach myself. Hi Sagar, and welcome. Can I ask you to please post co

[Tutor] A better way to estimate the value of Pi?

2011-10-17 Thread Sagar Shankar
Hi, this is my first question to this group. I'm a beginner to computer science and programming in Python. Am currently using John Zelle's book - Python Programming: An introduction to computer science to teach myself. In the book, there is an exercise to create a program that approximates the val