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
"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
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/
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
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
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
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
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
"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)
"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
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
>
> 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
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
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
>> 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/
15 matches
Mail list logo