[Tutor] Sqrt is listed as always available.

2006-02-15 Thread Kermit Rose
Sqrt is listed as always available. Why did I get these diagnostics? >>> Sqrt(J0) Traceback (most recent call last): File "", line 1, in -toplevel- Sqrt(J0) NameError: name 'Sqrt' is not defined >>> >>> sqrt(J0) Traceback (most recent call last): File "", line 1, in -toplevel- s

[Tutor] Need to write a python and call it within a python main program

2006-02-18 Thread Kermit Rose
I need to write a function that modifies its 4 imput values, a,b,c,d according to the following rules. set j = 8 * mod(a,2) + 4 * mod(b,2) + 2 * mod(c,2) + mod(d,2) if j = 0, a,b,c,d = a/2,b/2,c/2,d/2 if j = 1, a,b,c,d = -1,-1,-1,-1 if j = 2, a,b,c,d = a,b/2,c,d/2 if j = 3, a,b,c,d = a,(a

Re: [Tutor] Need to write a python and call it within a python main program (fwd)

2006-02-18 Thread Kermit Rose
    From: Danny Yoo Date: 02/18/06 15:18:14 To: Kermit Rose Cc: Tutor Subject: Re: [Tutor] Need to write a python and call it within a python main program (fwd)      Just as a note: please use your email client's "Reply to All" feature so that our correspondence stays on t

Re: [Tutor] Need to write a python : Thank you very much

2006-02-18 Thread Kermit Rose
      From: Alan Gauld Date: 02/18/06 17:51:17 To: Danny Yoo; Tutor Subject: Re: [Tutor] Need to write a python and call it within a pythonmainprogram (fwd)   > I know how to write functions in Fortran. > > Please help me with the syntax.   I don't know how to tell python to run a > main pro

Re: [Tutor] Need to write a python and call it within a python mainprogram (fwd): Thank you very much

2006-02-18 Thread Kermit Rose
      From: Alan Gauld Date: 02/18/06 18:00:09 To: Kermit Rose; Danny Yoo Cc: Tutor Subject: Re: [Tutor] Need to write a python and call it within a python mainprogram (fwd)   ?   Indentation is how python determines block sytructure.     In Python a colon says a block is coming up and

[Tutor] Bug in python

2006-02-19 Thread Kermit Rose
>>> a = 1 >>> a2 = a%2 >>> a2 1 >>> 8*a2 8 >>> 8*(a%2) 8 >>> 8*a%2 0 >>> The * is being given equal priority to %. Why isn't % given higher priority than *? Also, why am I getting a syntax error in the following? The def in the definition of the second function is being highlighted. IDLE

[Tutor] How can I make Python Shell see new version of function subroutine?

2006-02-19 Thread Kermit Rose
    From: John Fouhy Date: 02/19/06 16:33:18 To: Python Tutor Subject: [Tutor] Bug in python   See: http://docs.python.org/ref/summary.html   *, / and % all have the same precedence.  I guess the reasoning is that / is (approximately) the inverse of * and % is "remainder after /".       Hell

Re: [Tutor] How can I make Python Shell see new version of functionsubroutine?

2006-02-19 Thread Kermit Rose
    From: Kermit Rose Date: 02/19/06 17:05:53 To: Python Tutor; John Fouhy Subject: [Tutor] How can I make Python Shell see new version of functionsubroutine?      Hello John.   Ok.   I got steamed too quickly.   **     However, I have a debugging dilemma.   I made changes to one of

Re: [Tutor] How can I make Python Shell see new version of functionsubroutine?

2006-02-19 Thread Kermit Rose
    From: John Fouhy Date: 02/19/06 17:14:39 To: Python Tutor Subject: Re: [Tutor] How can I make Python Shell see new version of functionsubroutine?     Do you need to use copy and paste?  For instance, say all your functions are in a file called "factorization.py".  In IDLE, you could type

[Tutor] Generating small random integer

2006-02-19 Thread Kermit Rose
Hello. How can I find documentation on the random number generator function. It's not listed in the math module. In general, how can I find documentation on any particular function if I don't know what module it is in? Kermit<[EMAIL PROTECTED]> __

Re: [Tutor] Generating small random integer

2006-02-19 Thread Kermit Rose
    From: Adam Date: 02/19/06 18:25:05 To: Kermit Rose Cc: tutor@python.org Subject: Re: [Tutor] Generating small random integer     You might want to try the random module.   * Why did I get this diagnostic?     >>> factor0(3737)[1, 0, 0, 3737, 1, 1

Re: [Tutor] Generating small random integer

2006-02-19 Thread Kermit Rose
    From: John Fouhy Date: 02/19/06 19:01:26 To: tutor@python.org Subject: Re: [Tutor] Generating small random integer     You need to tell python that randint is in the random module.   ie, instead of calling randint(), call random.randint().     **   oops.   I should ha

Re: [Tutor] How can I make Python Shell see new version offunctionsubroutine?

2006-02-19 Thread Kermit Rose
    From: Alan Gauld Date: 02/19/06 19:55:13 To: Kermit Rose Cc: Python Tutor list Subject: Re: [Tutor] How can I make Python Shell see new version offunctionsubroutine?   Restoring the tutor list on CC   **   Thanks for reminding me.     Assuming Windows NT/2000/XP you go to My

Re: [Tutor] How can I make Python Shell see new versionoffunctionsubroutine?

2006-02-19 Thread Kermit Rose
    From: John Fouhy Date: 02/19/06 20:34:13 To: tutor@python.org Subject: Re: [Tutor] How can I make Python Shell see new versionoffunctionsubroutine?   > > Traceback (most recent call last): >   File "", line 1, in -toplevel- > import factor30.py > ImportError: No module named factor30

[Tutor] import of source code still not working

2006-02-20 Thread Kermit Rose
IDLE 1.1.2 >>> import factor30 >>> factor(109) Traceback (most recent call last): File "", line 1, in -toplevel- factor(109) NameError: name 'factor' is not defined >>> factor0(109) Traceback (most recent call last): File "", line 1, in -toplevel- factor0(109) Na

Re: [Tutor] import of source code still not working

2006-02-20 Thread Kermit Rose
    From: Jason Massey Date: 02/20/06 12:20:03 To: Kermit Rose Cc: tutor@python.org Subject: Re: [Tutor] import of source code still not working   If you don't want to have to put the factor30 in front of all your function names you can do this:from factor30 import *Which will put a

[Tutor] Debugging method

2006-02-20 Thread Kermit Rose
    Kermit have you actually bothered going through any tutorials? You just seem to be asking every time you get an error, I know the list is here for people to ask questions but you really should try and work some things out for yourself. Traceback (most recent call last):  File "", line 1,

[Tutor] Understanding the tutorial

2006-02-21 Thread Kermit Rose
    From: Danny Yoo Date: 02/20/06 19:22:23 To: Kermit Rose Cc: Tutor; John Fouhy Subject: Re: [Tutor] Generating small random integer   >  The thing I'm slightly worried about is that the questions you're asking seem answered directly by the tutorials we're pointing yo

[Tutor] Environmental variables?

2006-03-02 Thread Kermit Rose
In the primary tutor file, in section 2.2.4 The Interactive Startup File . It states: You can do this by setting an environment variable named PYTHONSTARTUP to the name of a file containing your start-up commands How do I set environmental variables in Windows? Kermit< [EM

[Tutor] windows help system

2006-03-03 Thread Kermit Rose
>> You can do this by setting an environment variable named PYTHONSTARTUP to >> name of a file containing your start-up commands > > How do I set environmental variables in Windows? If it's Windows 9x/Me use AUTOEXEC.BAT. SET PTYTHONSTARTUP C:\mypath\myfile.py If its Windows NT/2000/XP righ

[Tutor] odbchelper

2006-03-03 Thread Kermit Rose
When I tried to run a program show at the beginning of "Dive into Python", I got. Traceback (most recent call last): File "", line 1, in -toplevel- import odbchelper ImportError: No module named odbchelper >>> ___ Tutor maillist - Tuto

Re: [Tutor] windows help system

2006-03-03 Thread Kermit Rose
    From: Alan Gauld Date: 03/03/06 11:41:05 To: Kermit Rose; tutor@python.org Subject: Re: [Tutor] windows help system   > Environmental variable is not in the windows help glossary.   Strange, in both Windows 2000 and XP I type 'environment variable' into the search box an

[Tutor] Connection time out while attempting to install SOAP

2006-03-09 Thread Kermit Rose
I attempted to follow instructions from "Dive into Python" to install the SOAP package. The first step went ok. The second step is not yet accomplished. 12.2.2. Installing fpconst The second library you need is fpconst, a set of constants and functions for working with IEEE754 double-precision

[Tutor] need help tracing a syntax error

2006-03-11 Thread Kermit Rose
def vmod(a , b ): .r1 = b .r2 = a . m1 = 0 .m2 = 1 .q = Int(r1 / r2) .r3 = r1 - q * r2 .m3 = m1 - q * m2 .while r3 != 0: ...r1 = r2 ...m1 = m2 ...r2 = r3 ...m2 = m3 ...q = Int(r1 / r2) ...r3 = r1 - r2 * q ...m3 = m1 - m2 * q .If r2 == 1: ...If m2 < 0: .return( m2 + b) ...Else: .ret

[Tutor] urlopen: where are the results?

2006-03-22 Thread Kermit Rose
Anybody care to comment on the following? >>> from urllib2 import * >>> urlopen("http://www.kermitrose.com";) > >>> ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] urlopen: where are the results?

2006-03-23 Thread Kermit Rose
    From: Danny Yoo Date: 03/23/06 00:08:25 To: Kermit Rose Cc: tutor@python.org Subject: Re: [Tutor] urlopen: where are the results?      We can use 'import urllib2', or if we really want urlopen():   ## from urllib2 import urlopen ##   Thanks.     > >

Re: [Tutor] urlopen: where are the results?

2006-03-24 Thread Kermit Rose
    From: Alan Gauld Date: 03/23/06 11:34:33 To: Kermit Rose; Danny Yoo Cc: tutor@python.org Subject: Re: [Tutor] urlopen: where are the results?     Did you look at the url2lib documentation?       I thought I had,  but I did not see the examples.   I did not know enough to make sense

[Tutor] query python mastery via programming exercises

2006-05-07 Thread Kermit Rose
Hello. I would like to try to master python programming this summer. All the programming classes that I have taken previously used the technique of assigning programming exercises with examples of relevant techniques, and the task of the student is to study the examples, and apply them to solve

Re: [Tutor] query python mastery via programming exercises

2006-05-08 Thread Kermit Rose
    From: Alan Gauld Date: 05/08/06 06:20:42 To: Kermit Rose; tutor@python.org Subject: Re: [Tutor] query python mastery via programming exercises     The nearest to that is the Python Challenge 'game' web site. It presents a series of challenges to be solved in Python. Each chal

[Tutor] Reading characters from file in binary mode

2006-06-06 Thread Kermit Rose
Hello.   I wish to translate a SAS data file to text, and do not have the professional version of SAS to do so.   I have the student version of SAS, and have translated the shortest of 4 SAS data sets given.   For the other 3, I wish to construct a python program to read the characters in, on

Re: [Tutor] Tutor Digest, Vol 28, Issue 10

2006-06-06 Thread Kermit Rose
    From: [EMAIL PROTECTED] Date: 06/06/06 12:31:25 To: tutor@python.org Subject: Tutor Digest, Vol 28, Issue 10     Message: 9 Date: Tue, 06 Jun 2006 12:21:51 -0400 From: Kent Johnson <[EMAIL PROTECTED]> Subject: Re: [Tutor] Reading characters from file in binary mode To: Python Tutor

[Tutor] How do I get Dos to recognize python command?

2006-06-06 Thread Kermit Rose
I followed the model in http://www.byteofpython.info/read/source-file.html and saw following results. C:\DavidKaremera\June2006\SAS>python med.py 'python' is not recognized as an internal or external command, operable program or batch file. What do I do to make DOS recognize pyt

[Tutor] bounced email

2006-06-06 Thread Kermit Rose
My last email to you bounced. Why? From: [EMAIL PROTECTED] Date: 06/06/06 20:30:49 To: [EMAIL PROTECTED] Subject: The results of your email commands The results of your email command are provided below. Attached is your original message. - Unprocessed: Why am I getting th

[Tutor] end of line character seems to be invisible. why?

2006-06-06 Thread Kermit Rose
I ran the program #inp = open("CMT_MCAID", "rb") #out = open("mcaid.txt", "w") #for I in range(1,1000): #if I I%60=== 0: #out.write('\n') #ch = inp.read(1) #if not ch: break # EOF #k = ord(ch) # convert to integer #kl

[Tutor] Apologies

2006-06-06 Thread Kermit Rose
I%60 should have been I%12 My previous request has been solved. From: Kermit Rose Date: 06/06/06 22:05:17 To: tutor@python.org Subject: end of line character seems to be invisible. why? I ran the program # inp = open("CMT_MCAID", "rb") # out =

[Tutor] default module

2006-06-07 Thread Kermit Rose
Message: 3 Date: Tue, 06 Jun 2006 20:59:11 -0400 From: Kent Johnson <[EMAIL PROTECTED]> Subject: Re: [Tutor] How do I get Dos to recognize python command? To: Python Tutor > > Besides, I already have one default module saved, and it would seem > complicated to have more than one. I don't

[Tutor] module versus file

2006-06-07 Thread Kermit Rose
Message: 7 Date: Wed, 07 Jun 2006 08:12:59 -0400 From: Kent Johnson <[EMAIL PROTECTED]> Subject: Re: [Tutor] default module >> Hi Kermit, To make a module available for import, you just have to save it somewhere on your Python path. There are several ways to do this, ***

[Tutor] directory as package

2006-06-08 Thread Kermit Rose
Message: 4 Date: Wed, 7 Jun 2006 20:10:52 -0700 From: Dave Kuhlman <[EMAIL PROTECTED]> Subject: Re: [Tutor] module versus file To: tutor@python.org Hello Dave. >> If you are importing a module from a directory other than your current directory, then the directory is effectively a

[Tutor] file attribute of module

2006-06-09 Thread Kermit Rose
Message: 2 Date: Thu, 08 Jun 2006 09:28:27 -0400 From: Kent Johnson <[EMAIL PROTECTED]> Subject: Re: [Tutor] module versus file Most modules do have corresponding files. The exceptions are the ones built-in to Python. In fact modules have a __file__ attribute that tells you where it came from;

[Tutor] buggy bug in my program

2006-06-10 Thread Kermit Rose
# def insertw(j1,k,w1,w2,jar,limit): #trace = 1 #if k == 0: #jar[k][0] = k #jar[k][1] = w1 #jar[k][2] = w2 #return #if j1 > k: #jar[j1][0] = k #jar[j1][1] = w1 #jar[j1][2] = w2 #return # #for j2 in range(j1+1,k+

[Tutor] assignment statements in python

2006-06-11 Thread Kermit Rose
Message: 1 Date: Sun, 11 Jun 2006 06:58:39 -0400 From: Kent Johnson <[EMAIL PROTECTED]> Subject: Re: [Tutor] buggy bug in my program Cc: tutor@python.org Assignment in Python is not a copy, it is a name binding. Assignment creates a name for an object. If you assign the same object to two name

[Tutor] sorting in python

2006-06-12 Thread Kermit Rose
Message: 6 Date: Mon, 12 Jun 2006 05:59:16 -0400 From: Kent Johnson <[EMAIL PROTECTED]> Subject: Re: [Tutor] assignment statements in python Actually sorting doesn't require copying the values in the list, it just requires moving values to different locations of the list. * Yes. I w

[Tutor] Exercise in writing a python function.

2006-08-08 Thread Kermit Rose
Hello all. I feel more familar with Python now, and when I recently went back to reading the tutorial, I could actually read it without being overwhelmed by too much new detail. I've been staring at the specs for a python function for a while. I wrote one version of it and it worked.

Re: [Tutor] Exercise in writing a python function.

2006-08-09 Thread Kermit Rose
From: Alan Gauld Date: 08/09/06 03:30:28 To: Kermit Rose; tutor@python.org Subject: Re: [Tutor] Exercise in writing a python function. > The current specifications for the function are: > > def incr(mult,z,zlim,mpylist): > # mult is a vector of exponents for the multiplier

[Tutor] Exercise in writing a python function

2006-08-09 Thread Kermit Rose
Message: 2 Date: Wed, 9 Aug 2006 16:04:27 +1200 From: "John Fouhy" <[EMAIL PROTECTED]> Subject: Re: [Tutor] Exercise in writing a python function. To: "Tutor mailing list" Hi Kermit, Your basic data structure is a list (actually, several related lists), which you work your way through. S

[Tutor] programming exercise in Python

2006-08-09 Thread Kermit Rose
Thanks to John, I've written tenative code for the incr routine. Now to test and possibly debug it. Here is the routine. It's very short. # # # def incr(mult,zlim,mpylist): # # mult is a vector of exponents for the multipliers in mpylist. # # z is the integer to be factored # # zlim is

Re: [Tutor] programming exercise in Python

2006-08-09 Thread Kermit Rose
From: Danny Yoo Date: 08/09/06 11:01:14 To: Kermit Rose Cc: tutor@python.org Subject: Re: [Tutor] programming exercise in Python On Wed, 9 Aug 2006, Kermit Rose wrote: > I've written tenative code for the incr routine. > > Now to test and possibly debug it.

Re: [Tutor] programming exercise in Python

2006-08-09 Thread Kermit Rose
From: Alan Gauld Date: 08/09/06 12:53:59 To: Kermit Rose; tutor@python.org Subject: Re: [Tutor] programming exercise in Python > # lenmult = len(mult) This is pretty redundant, it only saves two characters typing, you might as well do ** hmm I had gotten in the ha

Re: [Tutor] programming exercise in Python

2006-08-09 Thread Kermit Rose
From: Alan Gauld Date: 08/09/06 13:52:09 To: Kermit Rose Cc: tutor@python.org Subject: Re: [Tutor] programming exercise in Python >> # testsum = 0 >> # if k > 0: >> # mult[k-1] = 0 >> # for j in range(k,lenmult): >> # testsum = testsum + mpylist[

[Tutor] function value

2006-08-12 Thread Kermit Rose
[1858741L, 53799857L, 0] to fermat routine. Retrieved from strongfac, face = [1858741L, 53799857L, 0] In fermat: k = 23 x = 1858741 y = 53799857 face = [1858741L, 53799857L, 0] index of torial is 23 z = 137 x = 1858741 y = 53799857 difficulty = 0 >>>

[Tutor] Global variables

2006-08-13 Thread Kermit Rose
From: Danny Yoo Date: 08/09/06 16:23:35 To: Kermit Rose Cc: tutor@python.org If I can figure out how to make my main function subroutine declare global variables then I won't need to pass parameters most parameters to the other subroutines, and will bypass the problem I'm h

Re: [Tutor] Global variables

2006-08-14 Thread Kermit Rose
From: Luke Paireepinart Date: 08/13/06 22:28:50 To: Kermit Rose Cc: Danny Yoo; tutor@python.org Subject: Re: [Tutor] Global variables Kermit Rose wrote: > > > From: Danny Yoo > Date: 08/09/06 16:23:35 > To: Kermit Rose > Cc: tutor@python.org > > >

Re: [Tutor] Global variables

2006-08-14 Thread Kermit Rose
From: Luke Paireepinart Date: 08/14/06 17:17:13 To: Kermit Rose Cc: Danny Yoo; tutor@python.org Subject: Re: [Tutor] Global variables > From: Luke Paireepinart > > are you asking a question? > > > Kermit Rose wrote: > > > Yes. How can I make a package

Re: [Tutor] Global variables

2006-08-14 Thread Kermit Rose
From: Alan Gauld Date: 08/14/06 18:42:41 To: Kermit Rose; Luke Paireepinart Cc: tutor@python.org; Danny Yoo Subject: Re: [Tutor] Global variables That may be true but you will make your code much less reusable and much more error propne in the process. There are good reasons why

[Tutor] Actual code that illustrates problem

2006-08-16 Thread Kermit Rose
ongfac, face = ",face #x = face[0] #y = face[1] #print " In fermat: k = ",k," x = ",x," y = ",y," face = " face #if face[0] != 0: #print " index of torial is ",k #return face #if k == 0: #w2 = w #else: #w2 = pow(w2,torials[k],z) #fac = strongfac(z,w2) #print " " # print " Could not find factors by strong probable prime test." Kermit Rose < [EMAIL PROTECTED] > ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Global variables

2006-08-16 Thread Kermit Rose
From: Bob Gailer Date: 08/14/06 20:24:00 To: [EMAIL PROTECTED]; tutor@python.org Subject: RE: [Tutor] Global variables A while back you attached factor34.py. Is that the program you are having trouble with? Yes! And you said it misbehaves "consistently with certain numbers

Re: [Tutor] Global variables

2006-08-16 Thread Kermit Rose
From: Alan Gauld Date: 08/15/06 03:37:21 To: Kermit Rose; [EMAIL PROTECTED] Cc: tutor@python.org; [EMAIL PROTECTED] Subject: Re: [Tutor] Global variables . The names have very little to do with it, the danger of global variable use is the reliance on side-effects and the tight

Re: [Tutor] All of Kermit's E-Mails

2006-08-17 Thread Kermit Rose
From: Luke Paireepinart Date: 08/17/06 02:29:01 To: Kermit Rose Cc: tutor@python.org Subject: Re: [Tutor] All of Kermit's E-Mails [was: Global Variables] >>> I really dislike the way you reply. Follow the standard format! Leave all the greater-than signs before

Re: [Tutor] Actual code that illustrates problem

2006-08-17 Thread Kermit Rose
>>> From: Danny Yoo Date: 08/17/06 04:02:35 To: Kermit Rose Cc: Tutor Subject: Re: [Tutor] Actual code that illustrates problem > # def strongfac(z,w): [function body cut] Ok, let's go through this step by step. * What is the intent of strongfac? *** To tr

Re: [Tutor] Undeliverable Mail

2006-08-17 Thread Kermit Rose
> From" Danny Yoo > /*Date:*/ 08/17/06 12:16:16 > To: Kermit Rose > /*Cc:*/ Luke Paireepinart <mailto:[EMAIL PROTECTED]>; > tutor@python.org <mailto:tutor@python.org> > /*Subject:*/ Re: [Tutor] All of Kermit's E-Mails > > > > > > Hi

Re: [Tutor] Actual code that illustrates problem

2006-08-17 Thread Kermit Rose
Danny Yoo wrote: > > > Hi Kermit, > > Ok, good. You should add this as a comment to the function's header, > so that other people can see this. Here is an example: > > def strongfac(z, w): > """z is the number to be factored. >w is a witness that may help find the factors of z. >

Re: [Tutor] All of Kermit's E-Mails

2006-08-17 Thread Kermit Rose
Brian van den Broek wrote: > > > Hi Kermit, > > I'd like to second Danny's suggestion of Thunderbird. It is a very > nice client by the same people that produce firefox. > > I spent a few minutes trying to find out how to set IncrediMail to > quote properly. Unfortunately, there is no downloadabl

Re: [Tutor] Actual code that illustrates problem

2006-08-17 Thread Kermit Rose
Alan Gauld wrote: > > While others have made good suggestions to clarify the code I thought > I'd try to tackle the question of whether we had a bug in Python. > > Unfortunately the debug output does not come from the code that's > posted so its difficult to figure out what's been happening. > > Fo

Re: [Tutor] Actual code that illustrates problem

2006-08-18 Thread Kermit Rose
Alan Gauld wrote: > #print " " #print " In strongfac " #print " Found1: x = ",x >>> >>> You could do all of this with a single print: >>> >>> print "\n In strongfac \nFound1: x = ", x >>> >> uh.. Too compact for me. >> I nee

Re: [Tutor] All of Kermit's E-Mails

2006-08-19 Thread Kermit Rose
Brian van den Broek wrote: > > Kermit Rose said unto the world upon 17/08/06 02:38 PM: > >> Now if I can only get Thunderbird to quit treating the up and down >> arrow as a page up or page down, >> whenever it's at the top line or bottom line of what it think

[Tutor] tuples versus lists

2006-09-14 Thread Kermit Rose
Hello Brian. Today I read through chapter five of the python tutorial and discovered that tuples are not the same thing as lists. This surprised me. I do not see any difference in the capability of lists and tuples. Why would you use one in preference to the other? Kermit < [EMAIL PROTE