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
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 thinks is a
page.
Hi Kermit,
I'm glad you've
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 need to see the logic more spread out.
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 try to find factors
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 Kermit,
Try sending the code as a file attachment. It's large enough
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 downloadable
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.
For
#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
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
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
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
If I can figure out how to make my main
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
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 having
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 multipliers in mpylist
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 tutor@python.org
Hi Kermit,
Your basic data structure is a list (actually, several related lists),
which you work your way
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
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.
Just as a note
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 habit
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[j][1] * mult[j]
My brain is bending
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.
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
# 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
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
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;
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 package.
In
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 tutor@python.org
Besides, I already have one default module saved, and it would seem
complicated to have more than
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,
***
Yes. By
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, one
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
I followed the model in
http://www.byteofpython.info/read/source-file.html
and saw following results.
C:\DavidKaremera\June2006\SASpython 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
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
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 = open(mcaid.txt, w
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
challenge uses
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
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
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.
urlopen("
Anybody care to comment on the following?
from urllib2 import *
urlopen(http://www.kermitrose.com;)
addinfourl at 13510096 whose fp = socket._fileobject object at
0x00CDD768
___
Tutor maillist - Tutor@python.org
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:
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
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
right
When I tried to run a program show at the beginning of Dive into Python,
I got.
Traceback (most recent call last):
File pyshell#2, line 1, in -toplevel-
import odbchelper
ImportError: No module named odbchelper
___
Tutor maillist -
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 and the list of topics
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
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 you to.If there
is something
IDLE 1.1.2
import factor30
factor(109)
Traceback (most recent call last):
File pyshell#1, line 1, in -toplevel-
factor(109)
NameError: name 'factor' is not defined
factor0(109)
Traceback (most recent call last):
File pyshell#2, line 1, in -toplevel-
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 all of your
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 "pyshell#8",
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 1.1.2
def
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
/".
Hello John.
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
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]
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, 3737, 1]
Traceback
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 have know
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 Computer
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 "pyshell#270", line 1, in -toplevel-
import factor30.py
ImportError: No module named
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 program and
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 everything
Sqrt is listed as always available.
Why did I get these diagnostics?
Sqrt(J0)
Traceback (most recent call last):
File pyshell#1, line 1, in -toplevel-
Sqrt(J0)
NameError: name 'Sqrt' is not defined
sqrt(J0)
Traceback (most recent call last):
File pyshell#3, line 1, in -toplevel-
58 matches
Mail list logo