Re: [Tutor] Generate Prime Numbers

2015-05-30 Thread Alan Gauld
On 30/05/15 00:37, Cameron Simpson wrote: def IsDivisibleBy3(number):#string variable return not int(number) % 3 To illustrate that there isn't just One Right Way, I would code the above like this: def IsDivisibleBy3(number): #string variable return int(number) % 3 == 0 Alan's cod

[Tutor] unittest with random population data

2015-05-30 Thread Sydney Shall
MAC OSX 10.10.3 Enthought Python 2.7 I am an almost beginner. Following advice from you generous people, I have chosen a project that interests me, to develop some knowledge of python. My projest is a simulation of a biological population. I have a base class and a simulation function, which u

Re: [Tutor] unittest with random population data

2015-05-30 Thread Peter Otten
Sydney Shall wrote: > MAC OSX 10.10.3 > Enthought Python 2.7 > > I am an almost beginner. > > Following advice from you generous people, I have chosen a project that > interests me, to develop some knowledge of python. > My projest is a simulation of a biological population. > I have a base clas

[Tutor] League Secretary Application

2015-05-30 Thread Stephen Nelson-Smith
Hello, I'm the league secretary for a table tennis league. I have to generate a weekly results report, league table, and player averages, from results cards which arrive by post or email. The data is of the form: Division: 1 Week: 7 Home: Some Team Away: Different Team Player A: Fred Bloggs Pla

Re: [Tutor] League Secretary Application

2015-05-30 Thread Stephen Nelson-Smith
Hullo, On Sat, May 30, 2015 at 3:49 PM, Laura Creighton wrote: > > 2. How do you receive your data now? Do you want to change this, > perhaps extend the capabilities -- i.e. let people send an sms > with results to your cell phone? Or limit the capabilities ("Stop > phoning me wit

Re: [Tutor] League Secretary Application

2015-05-30 Thread Joel Goldstick
On Sat, May 30, 2015 at 12:08 PM, Stephen Nelson-Smith wrote: > Hullo, > > On Sat, May 30, 2015 at 3:49 PM, Laura Creighton wrote: > >> >> 2. How do you receive your data now? Do you want to change this, >> perhaps extend the capabilities -- i.e. let people send an sms >> with results t

Re: [Tutor] unittest with random population data

2015-05-30 Thread Laura Creighton
In a message of Sat, 30 May 2015 12:16:01 +0100, Sydney Shall writes: >MAC OSX 10.10.3 >Enthought Python 2.7 > >I am an almost beginner. > >Following advice from you generous people, I have chosen a project that >interests me, to develop some knowledge of python. >My projest is a simulation of a b

Re: [Tutor] League Secretary Application

2015-05-30 Thread Laura Creighton
In a message of Sat, 30 May 2015 13:32:09 +0100, Stephen Nelson-Smith writes: >Hello, > >I'm the league secretary for a table tennis league. I have to generate a >weekly results report, league table, and player averages, from results >cards which arrive by post or email. > >The data is of the form

Re: [Tutor] League Secretary Application

2015-05-30 Thread Alan Gauld
On 30/05/15 17:08, Stephen Nelson-Smith wrote: 3. After you have performed your calculation and made a table, what do you do with it? Email it to members? Publish it in a weekly dead-tree newspaper? Post it to a website? What you want to do with it once you have it is also ver

Re: [Tutor] Generate Prime Numbers

2015-05-30 Thread Mirage Web Studio
On 2015-05-29 11:18 PM, Alan Gauld wrote: On 29/05/15 16:28, George wrote: Below is a sample code i created. Can i better it any way? Of course. There is always improvements that can be made. But in your case there are quite a few! def IsDivisibleBy3(number):#string variable v=0

Re: [Tutor] Generate Prime Numbers

2015-05-30 Thread Danny Yoo
I'll review the code a bit. > import time > > starttime=time.time() > > class Number: > def __init__(self,number,p=None,n=None): > self.no=number > self.marked=None > self.p=p > self.n=n It would be helpful to document what the types of 'p' and 'n' are here.

Re: [Tutor] Generate Prime Numbers

2015-05-30 Thread Alan Gauld
On 30/05/15 19:14, Mirage Web Studio wrote: and have at first devised a solution using class-object, thinking it easier, but it proved to be slower than my basic algorithm which i submitted earlier, I'm not surprised. You seem to have a talent for finding complex solutions to fairly simple pr

Re: [Tutor] unittest with random population data

2015-05-30 Thread Steven D'Aprano
On Sat, May 30, 2015 at 12:16:01PM +0100, Sydney Shall wrote: > I have written a unittest class which works OK. > But the problem I have is that because I use the random module to > populate my initial arrays, my data is not strictly predictable even > though I am using seed(0). Please show us

Re: [Tutor] unittest with random population data

2015-05-30 Thread Cameron Simpson
On 30May2015 12:16, Sydney Shall wrote: Following advice from you generous people, I have chosen a project >that interests me, to develop some knowledge of python. My projest is a simulation of a biological population. I have a base class and a simulation function, which uses instances of the