Re: [Tutor] my first project: a multiplication trainer

2008-03-15 Thread Alan Gauld
"Guba" <[EMAIL PROTECTED]> wrote > I want to create a simple multiplication trainer which quizzes me on > the > multiplication table. All multiplication combinations should be > asked > once, without repetition. > > Here my pseudo code: > I would very much appreciate if you could comment on/c

[Tutor] Fwd: my first project: a multiplication trainer

2008-03-15 Thread Marc Tompkins
Forgot to Reply All... -- Forwarded message -- From: Marc Tompkins <[EMAIL PROTECTED]> Date: Sat, Mar 15, 2008 at 2:13 AM Subject: Re: [Tutor] my first project: a multiplication trainer To: Guba <[EMAIL PROTECTED]> On Fri, Mar 14, 2008 at 9:43 PM, Guba <[EMAIL PROTECTED]> wrote:

Re: [Tutor] my first project: a multiplication trainer

2008-03-15 Thread Chris Fuller
The basic approach I use in these sorts of problems is to generate the choices, remove them from a list as they are asked, and then stop when this list is empty. If you don't need the list of questions afterwards, this will work: from random import choice questions = [ [i,j] for i in range(1

Re: [Tutor] my first project: a multiplication trainer

2008-03-15 Thread Ricardo Aráoz
Chris Fuller wrote: > The basic approach I use in these sorts of problems is to generate the > choices, remove them from a list as they are asked, and then stop when this > list is empty. > > > If you don't need the list of questions afterwards, this will work: > > from random import choice >

Re: [Tutor] my first project: a multiplication trainer

2008-03-15 Thread Kent Johnson
Guba wrote: > Hello everybody, > > I want to create a simple multiplication trainer which quizzes me on the > multiplication table. All multiplication combinations should be asked > once, without repetition. I would - create the list of questions - random.shuffle the list - iterate over the quest

Re: [Tutor] Fwd: my first project: a multiplication trainer

2008-03-15 Thread Kent Johnson
Marc Tompkins wrote: > Myself, I have a horrible time writing pseudocode without slipping into > real-code syntax Me too - often Python is more concise, precise and expressive than English for expressing an algorithm. > while len(possibleQuestions) > 0: could be simply while possibleQuest

Re: [Tutor] my first project: a multiplication trainer

2008-03-15 Thread Kent Johnson
Ricardo Aráoz wrote: > Considering the fact that choices[x] == x, Only until the first delete (that is not at the end). > shouldn't it be : > del choices[proxyq] No. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/list

Re: [Tutor] my first project: a multiplication trainer

2008-03-15 Thread tiger12506
> Considering the fact that choices[x] == x, shouldn't it be : > del choices[proxyq] choices = [9,2,1,3,6,4,7,8,5,0] for idx, x in enumerate(choices): print idx == x False False False True False False False False False False Not always. ___ Tutor

[Tutor] login

2008-03-15 Thread SwartMumba snake
I am trying to get the cookies from the site when I login, though html.info(). The problem is that when I check the source ( html.read() ) it shows that it does not recognize me as logged in. Also, if I chech html.info(), the cookies that I am suppose to receive, if I logged in successfully, are no

Re: [Tutor] my first project: a multiplication trainer

2008-03-15 Thread Ricardo Aráoz
Kent Johnson wrote: > Ricardo Aráoz wrote: >> Considering the fact that choices[x] == x, > > Only until the first delete (that is not at the end). > >> shouldn't it be : >> del choices[proxyq] > > No. > > Kent > Ooops! Missed that one, sorry.

Re: [Tutor] login

2008-03-15 Thread Kent Johnson
SwartMumba snake wrote: > I am trying to get the cookies from the site when I login, though > html.info(). The problem is that when I check the source ( html.read() ) > it shows that it does not recognize me as logged in. Also, if I chech > html.info(), the cookies that I am suppose to receive,

[Tutor] login

2008-03-15 Thread SwartMumba snake
Using the cookie jar is not going to solve my problem. I don't want to use the cookie jar. I just want to send the right request so that I will be sent back the right header, which will contain the information that I want. Apparently I am not sending the right request because the header that I am r

Re: [Tutor] hypotenuse

2008-03-15 Thread Ole Henning Jensen
bob gailer wrote: > Robert Childers wrote: >> I have rewritten my "hypotenuse" program as follows:>>> #This program >> calculates the width and diagonal of a golden rectangle > print "Calculate the width and diagonal of a golden rectangle." >> Calculate the width and diagonal of a golden recta

Re: [Tutor] login

2008-03-15 Thread Kent Johnson
SwartMumba snake wrote: > Using the cookie jar is not going to solve my problem. I don't want to > use the cookie jar. I just want to send the right request so that I will > be sent back the right header, which will contain the information that I > want. Apparently I am not sending the right req

Re: [Tutor] Parsing DICOMRT file

2008-03-15 Thread Bryan Fodness
Haven't had a chance to look at this in a while. On Wed, Dec 12, 2007 at 6:57 PM, John Fouhy <[EMAIL PROTECTED]> wrote: > On 13/12/2007, Bryan Fodness <[EMAIL PROTECTED]> wrote: > > I am new to doing anything like this. I have looked at > > http://www.leadtools.com/SDK/Medical/DICOM/ltdc1.htm an

[Tutor] signal trapping in a class instance

2008-03-15 Thread dave selby
Hi all, I have a series of class instances saved in an array. I need the instances to respond to a SIGKILL by writing to a file and sys.exit()-ing. Am I right in codeing it as below ? ... does the sys.exit() kill the instance or the instance & the instance holding array definition above it ? Che

Re: [Tutor] signal trapping in a class instance

2008-03-15 Thread Chris Fuller
SIGKILL is not trappable. You probably want SIGTERM. Furthermore, this signal will be sent to the process, not some thread or class instance within a process. Maybe you need some other mechanism? Is the signal going to be from the same python process? If so, just call it directly. Otherwis

Re: [Tutor] signal trapping in a class instance

2008-03-15 Thread Chris Fuller
I read your post again, and it looks as though you might want to use the atexit module.  Another idea would be to trap the SIGTERM signal and to keep a registry of instances, and then to invoke a cleanup method of each instance. Another important note: trapping signals will have no effect if yo

[Tutor] noob python cgi

2008-03-15 Thread Tyler Smith
Hi, I'm writing a webpage as a learning exercise. My first objective is to allow myself to upload files to directories in /images/, and have cgi scripts automatically generate the pages that will allow users to navigate through the images. I have a very basic prototype that does what I want, at l

Re: [Tutor] noob python cgi

2008-03-15 Thread Luke Paireepinart
Tyler Smith wrote: > Hi, > [snip explanation] > Three files follow. First, the html index page, followed by the > gallery picker, followed by the thumbnail displayer. > > Thanks! > > Tyler > [snip code] > In the future please include your code as attachments, to avoid e-mail programs mangling t

Re: [Tutor] Working with Python Objects

2008-03-15 Thread Dinesh B Vadhia
Alan/Greg I've combined your code fragments and added a function call too, to determine how 'a' is passed between objects and classes: def addNumbers(i, j): k = i + j return k class A: def oneA(self): z = 2 self.a = self.a * z class B: def oneB(self): in

Re: [Tutor] pydoc introspecting info via OptionParser?

2008-03-15 Thread Neal McBurnett
On Fri, Mar 14, 2008 at 10:43:08AM -0700, Neal McBurnett wrote: > I'm trying to do nice clean documentation for a python script I run > from the command-line, and I'd like pydoc or a similar program to > document it well. But I don't want to duplicate option information by > putting it both in my

[Tutor] [tutor] PyGame tutorials

2008-03-15 Thread Varsha Purohit
Hello all, I have learnt python and wxPython. Now i want to learn making games using pygame engine. Can anyone tellme from where i can learn pygame and start making basic games using this module. Which version i should download and is there any user group like this one for pyGame ?? thanks