[Tutor] my first project: a multiplication trainer

2008-03-14 Thread Guba
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. Here my pseudo code: ### A = [1,2,3,4,5,6,7,8,9] B = [1,2,3,4,5,6,7,8,9] asked_questions

Re: [Tutor] Working with Python Objects

2008-03-14 Thread Alan Gauld
"Dinesh B Vadhia" <[EMAIL PROTECTED]> wrote class A: constantA = 9 def OneOfA: a = class B: variableB = "quick brown fox" def OneOfB: b = c = b * a# the 'a' from def OneOfA in class

[Tutor] My tutor is back

2008-03-14 Thread ALAN GAULD
I have no idea why it took my ISP so long but after 4 weeks my Tutorial is finally back up on its original address... Hooray! Alan G. http://www.freenetpages.co.uk/hp/alan.gauld/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/

Re: [Tutor] Working with Python Objects

2008-03-14 Thread Greg Graham
Dinesh wrote: > I've avoided it as long as possible but I've reached a stage where I have to > start using Python objects! The primary reason is that the web framework uses > objects and the second is to eliminate a few globals. Here is example pseudo > code followed by the question (one of many

Re: [Tutor] hypotenuse

2008-03-14 Thread bob gailer
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 rectangle. > >>> height = in

[Tutor] pydoc introspecting info via OptionParser?

2008-03-14 Thread Neal McBurnett
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 docstring and in optparse. I would think that pydoc might notice an Opt

[Tutor] Working with Python Objects

2008-03-14 Thread Dinesh B Vadhia
I've avoided it as long as possible but I've reached a stage where I have to start using Python objects! The primary reason is that the web framework uses objects and the second is to eliminate a few globals. Here is example pseudo code followed by the question (one of many I suspect!): class

Re: [Tutor] hypotenuse

2008-03-14 Thread Robert Childers
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 rectangle. >>> height = input ("Input height:") Input height

Re: [Tutor] hypotenuse

2008-03-14 Thread Alan Gauld
"Wolfram Kraus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Am 14.03.2008 09:40, Alan Gauld schrieb: Why can you not use something like: >>> hypotenuse = hyp_squared**1/2 >> >> And for completeness that could also be written: >> >> hypotenuse = pow(hyp_squared,1/2)

Re: [Tutor] Idle

2008-03-14 Thread Alan Gauld
"Michael Connors" <[EMAIL PROTECTED]> wrote > You need to put : > import random > > or alternatively use: > from random import * Or better still use from random import randrange import * style is not recommended because of the dangers of polluting the namespace -- Alan Gauld Author of th

Re: [Tutor] Idle

2008-03-14 Thread Bartruff, Pamela J.
I'm very new to Python, but it seems like I just learned in a class for a random number, you would need the : import random -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Christopher Marlett Sent: Thursday, March 13, 2008 7:44 PM To: tutor@python.org Subj

Re: [Tutor] Idle

2008-03-14 Thread Michael Connors
> > It all works up until I need to print five randomly chosen numbers from > the range [1,n]. It tells me that random is not defined. You need to put : import random in your program before doing: y = random.randrange(1,n) or alternatively use: from random import * and call the function as fol

[Tutor] Idle

2008-03-14 Thread Christopher Marlett
Hi, I'm trying to write a program that uses the range function to produce and then print [1, 2, 3, 4]. then prompt the user for an integer n and print the list [1, 2, 3, ... , n] – including n. Then use a simple repeat loop to print five randomly chosen numbers from the range [1, 2, 3, ... , n] Th

Re: [Tutor] hypotenuse

2008-03-14 Thread Wolfram Kraus
Am 14.03.2008 09:40, Alan Gauld schrieb: >>> Why can you not use something like: >>> >> hypotenuse = hyp_squared**1/2 > > And for completeness that could also be written: > > hypotenuse = pow(hyp_squared,1/2) > > Again, without the need to import math. > But beware of the integer divison in

Re: [Tutor] hypotenuse

2008-03-14 Thread Alan Gauld
>> Why can you not use something like: >> >> >>>hypotenuse = hyp_squared**1/2 And for completeness that could also be written: hypotenuse = pow(hyp_squared,1/2) Again, without the need to import math. -- Alan Gauld Author of the Learn to Program web site Temorarily at: http://uk.geocities.com/