Re: [Tutor] help

2009-03-13 Thread Emile van Sebille
Sanhita Mallick wrote: help YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING . AROUND YOU IS A FOREST. A SMALL STREAM FLOWS OUT OF THE BUILDING AND DOWN A GULLY. Emile ___ Tutor maillist - Tutor@python.org http://mail.python

Re: [Tutor] HELP ON A ANAGRAM PYTHON PROGRAM

2009-03-09 Thread christopher . henk
Just glancing at your program, I would guess that you have a ":" where you want a "]" on the line below. prod = prod * letter_to_prime[word_list[j] [i]: HTH, Chris jessica cruz Sent by: tutor-bounces+christopher.henk=allisontransmission@python.org 03/09/2009 02:38 PM To Tutor@p

Re: [Tutor] HELP ON A ANAGRAM PYTHON PROGRAM

2009-03-09 Thread wesley chun
On Mon, Mar 9, 2009 at 10:38 AM, jessica cruz wrote: > I made this program but it says that there is an error and I have a hard > time trying to solve the problem with program. >        : > I don't know how to figure out the error since the only message that I get > is that "there's an error: inva

Re: [Tutor] HELP ON A ANAGRAM PYTHON PROGRAM

2009-03-09 Thread Kent Johnson
On Mon, Mar 9, 2009 at 1:38 PM, jessica cruz wrote: > I don't know how to figure out the error since the only message that I get > is that "there's an error: invalid syntax" Please copy & paste the whole error message including the traceback so we know where the error is. Kent _

Re: [Tutor] help with loop that is to be fed out of a word list

2009-02-10 Thread Alan Gauld
"David" wrote def uses_all(word, required): for letter in required: if letter not in word: return False return True Now, I want to feed this code a list of words. This is what I have so far: def uses_all(required): It is usually better to leave things that work a

Re: [Tutor] help with loop that is to be fed out of a word list

2009-02-09 Thread John Fouhy
2009/2/10 David : > Dear list, > > out of "Thinking in Python" I take the following code, which > "takes a word and a string of required letters, and that returns True if > the word uses all the required letters at least once". > > > def uses_all(word, required): >for letter in required: >

Re: [Tutor] help on making python tictactoe

2009-01-19 Thread Brian Mathis
On Mon, Jan 19, 2009 at 4:18 AM, jammy007 pp wrote: > guys , i need immediate help on creating a simple tictactoe game . > > i read micheal dawson's book but didnt quiet get it . > > please help . > > thanks . > > jammy The purpose of homework is that you figure it out for yourself and learn som

Re: [Tutor] help on making python tictactoe

2009-01-19 Thread bhaaluu
On Mon, Jan 19, 2009 at 4:18 AM, jammy007 pp wrote: > guys , i need immediate help on creating a simple tictactoe game . > > i read micheal dawson's book but didnt quiet get it . > > please help . > > thanks . > > jammy Python Programming for the Absolute Beginner 2E by Michael Dawson has the BES

Re: [Tutor] help on making python tictactoe

2009-01-19 Thread spir
Le Mon, 19 Jan 2009 01:18:41 -0800 (PST), jammy007 pp a écrit : > guys , i need immediate help on creating a simple tictactoe game . > > i read micheal dawson's book but didnt quiet get it . > > please help . > > thanks . > > jammy > > > > try googling: "software developpment compa

Re: [Tutor] Help with elif

2009-01-18 Thread Alan Gauld
"Alan Gauld" wrote If you already know Java, even a little bit then my tutorial will be too basic for you. I'd try the Byte of Python website/book. Actually I meant the dive into python website/book. Not that there's anything wrong with "Byte of" either, but "Dive In" seems more appropria

Re: [Tutor] Help with elif

2009-01-18 Thread Kent Johnson
On Sat, Jan 17, 2009 at 10:21 PM, Ian Egland wrote: > In regards to learning python, I've found that after I get somewhat-familiar > with a language, I want a programming problem to solve with what I've > learned. While learning Java, http://www.javabat.com has been my best > friend. (That is, as

Re: [Tutor] Help with elif

2009-01-18 Thread Alan Gauld
"Ian Egland" wrote learned. While learning Java, http://www.javabat.com has been my best friend. (That is, as close to a best friend as programming website can be.) Is there something like this for Java? Is one in the works? If you already know Java, even a little bit then my tutorial will

Re: [Tutor] Help with elif

2009-01-17 Thread Kent Johnson
On Sat, Jan 17, 2009 at 10:21 PM, Ian Egland wrote: > I have looked at a couple tutorials and whipped this up. However, attempting > to run it in IDLE results in a syntax error leaving my elif highlighted in > red. What's wrong? I've looked at the code and can't find any syntax errors- > though I'

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Alan Gauld
"Brian van den Broek" wrote I'll have him verify all steps again and then call `gremlins'. One last thing to try is to get him to send a screen shot with the error message showing. That will prove that he is using the right type of console, typing the right command and reporting the righ

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Brian van den Broek
Kent Johnson said unto the world at 15/01/09 12:33 PM: On Thu, Jan 15, 2009 at 11:48 AM, Brian van den Broek wrote: The (recognized by me as) relevant bits of output are: Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\texlive\2008\bin\win32;C:\Python26 PATHEXT=.CO

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Alan Gauld
"Brian van den Broek" wrote The (recognized by me as) relevant bits of output are: Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\texlive\2008\bin\win32;C:\Python26 PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH That looks OK. Puzzling! Scraping th

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Marc Tompkins
On Thu, Jan 15, 2009 at 8:48 AM, Brian van den Broek wrote: > > The (recognized by me as) relevant bits of output are: > Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program > Files\texlive\2008\bin\win32;C:\Python26 > PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH > >

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Marc Tompkins
On Thu, Jan 15, 2009 at 9:35 AM, Dj Gilcrease wrote: > if he just needs to run python scripts you just need to type the > script name (preferably from the directory it is in) > > eg: C:\Path\To\App>app_name.py > > and it will run > By default, and on most people's machines, not true. You can do

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Dj Gilcrease
if he just needs to run python scripts you just need to type the script name (preferably from the directory it is in) eg: C:\Path\To\App>app_name.py and it will run Also if you have changed the enviromental variables, you need to close the command prompt and re-open it on windows since it does n

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Kent Johnson
On Thu, Jan 15, 2009 at 11:48 AM, Brian van den Broek wrote: > The (recognized by me as) relevant bits of output are: > Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program > Files\texlive\2008\bin\win32;C:\Python26 > PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH > >

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Brian van den Broek
Brian van den Broek said unto the world at 15/01/09 11:27 AM: Alan Gauld said unto the world at 14/01/09 07:34 PM: "Brian van den Broek" wrote DOS prompt and replies including Alan's suggestion to get a text file dump of environment variables.> With the full path, python loads as expecte

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Brian van den Broek
Alan Gauld said unto the world at 14/01/09 07:34 PM: "Brian van den Broek" wrote icon for Idle launching as expected. When run from IDLE, `print sys.executable' yields `C:\\Python26\\pythonw.exe'. He reports that C:\Python26 contains both python.exe and pythonw.exe. I've had him add the tex

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-14 Thread Alan Gauld
"Marc Tompkins" wrote - Also as wesley said, there MAY BE two separate PATHs - in my experience, the user-level one is usually empty and can be deleted to avoid confusion. If it's _not_ empty, it's usually by mistake... It should be used where multiple users use a single machine and they

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-14 Thread Alan Gauld
"Brian van den Broek" wrote icon for Idle launching as expected. When run from IDLE, `print sys.executable' yields `C:\\Python26\\pythonw.exe'. He reports that C:\Python26 contains both python.exe and pythonw.exe. I've had him add the text `;C:\Python26' (without quotes) to the end of his

Re: [Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Marc Tompkins
On Wed, Jan 14, 2009 at 12:09 PM, wesley chun wrote: > > i fully agree with kent's comments/suggestions. you appeared to have > them do the right thing. fwiw, the only time i run into that error > after doing the same thing as you is that i'm trying that command in > an already-opened command win

Re: [Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread wesley chun
On Wed, Jan 14, 2009 at 12:01 PM, Kent Johnson wrote: > On Wed, Jan 14, 2009 at 2:36 PM, Brian van den Broek > wrote: >> >> He's got python 2.6.1 installed as evidenced by the Startbar program >> icon for Idle launching as expected. When run from IDLE, `print >> sys.executable' yields `C:\\Python

Re: [Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Kent Johnson
On Wed, Jan 14, 2009 at 2:36 PM, Brian van den Broek wrote: > Hi all, > > I'm trying, via email, to help a friend set up python on his Windows > XP computer. I've been strictly linux for some time now, and don't > have a Windows machine on which to investigate. We've hit a problem, > and I'd appre

Re: [Tutor] help

2009-01-11 Thread Alan Gauld
"rev pacce" wrote I have no expierence using python. I was following a tutorial and i kept getting a syntax error. it was >>> print "hello world!" hello world was not coming up OK, I guess that you tried typing the >>> howerver that bit should be produced by the Python interpreter. You n

Re: [Tutor] help

2009-01-11 Thread jadrifter
On Sun, 2009-01-11 at 14:01 -0800, rev pacce wrote: > I have no expierence using python. I was following a tutorial and i > kept getting a syntax error. it was >>> print "hello world!" hello > world was not coming up underneath it.. i tried to run the module but > that didnt work either. > > __

Re: [Tutor] Help with a simple problem

2009-01-03 Thread bob gailer
Saad Javed wrote: The bold was intentional. I was trying to get a shell command (wvdial) to run when a button is pressed. The error I get is: Traceback (most recent call last): File "testgui.py", line 26, in testgui = TestGui() File "testgui.py", line 19, in __init__ self.connect(d

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Saad Javed
I implemented a dial function and passed it to the QtCore.SLOT(), which worked fine. Thanks everyone! On Sat, Jan 3, 2009 at 10:33 PM, Kent Johnson wrote: > On Sat, Jan 3, 2009 at 11:39 AM, Saad Javed wrote: > > The bold was intentional. I was trying to get a shell command (wvdial) to > > run w

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Kent Johnson
On Sat, Jan 3, 2009 at 12:28 PM, Alan Gauld wrote: > I think the SIGNAL('clicked()') bit is probably supposed to be: > > SIGNAL('clicked') I think the parens are correct, see http://docs.huihoo.com/pyqt/pyqt4.html#id10 Kent ___ Tutor maillist - Tuto

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Kent Johnson
On Sat, Jan 3, 2009 at 11:39 AM, Saad Javed wrote: > The bold was intentional. I was trying to get a shell command (wvdial) to > run when a button is pressed. The error I get is: > > Traceback (most recent call last): > File "testgui.py", line 26, in > testgui = TestGui() > File "testgui.

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Alan Gauld
"Saad Javed" wrote self.connect(dial, QtCore.SIGNAL('clicked()'), QtGui.qApp, QtCore.SLOT(os.system('wvdial'))) TypeError: argument 1 of SLOT() has an invalid type Was that helpful? Yes, it confirms my earlier email that you should probably quote the argument to SLOT() Alan G. __

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Alan Gauld
"Saad Javed" wrote I'm trying to create a simple GUI using pyqt4 in which pressing a button causes execution of a system command. Here's the code, please help me out. I can't figure out whats wrong. Thanks Caveat: I have never used Qt in my life so this is based on guesswork and experience

Re: [Tutor] Help with a simple problem

2009-01-03 Thread Saad Javed
The bold was intentional. I was trying to get a shell command (wvdial) to run when a button is pressed. The error I get is: Traceback (most recent call last): File "testgui.py", line 26, in testgui = TestGui() File "testgui.py", line 19, in __init__ self.connect(dial, QtCore.SIGNAL('c

Re: [Tutor] Help with a simple problem

2009-01-03 Thread bob gailer
Saad Javed wrote: Hi Tutors, Hi and welcome to the tutor list. We can help you better if you tell us what the problem is. What did you expect? What did you get? Most of us don't have the time or energy to read code when we don't know what we are looking for. Some of your code is bold. Why?

Re: [Tutor] help finding recurring cycle

2008-12-23 Thread col speed
Thank you, thank you thank you! I'm now well on my way to solving my 35th problem!! The wiki is fantastic, I thought "of course - I should have known that!" It's easy when you know how. Thanks again, especially for the prompt replies 2008/12/24 bob gailer > Kent Johnson wrote: > >> On Tue, Dec 2

Re: [Tutor] help finding recurring cycle

2008-12-23 Thread bob gailer
Kent Johnson wrote: On Tue, Dec 23, 2008 at 8:20 PM, col speed wrote: I've written a "division" function that gives more decimal places than the one already in python. What my poor old brain can't work out is how to find a "recurring cycle" which isn't disastrously complicated (as the cycle

Re: [Tutor] help finding recurring cycle

2008-12-23 Thread Kent Johnson
On Tue, Dec 23, 2008 at 8:20 PM, col speed wrote: > I've written a "division" function that gives more decimal places than the > one already in python. What my poor old brain can't work out is how to find > a "recurring cycle" which isn't disastrously complicated (as the cycle > doesn't always in

Re: [Tutor] help needed from python beginner

2008-12-23 Thread Alan Gauld
"moham ilias" wrote in message news:74b58e470812230730n4c3c5d1eg9f44a87b1bf9...@mail.gmail.com... can anybody help me to get the example codes for some existing python projects. pls help in this regard For simple examples try the Useless Python web site. In particular check out the link t

Re: [Tutor] help needed from python beginner

2008-12-23 Thread Kent Johnson
On Tue, Dec 23, 2008 at 10:30 AM, moham ilias wrote: > can anybody help me to get the example codes for some existing python > projects. pls help in this regard I'm not sure I understand your question. Do you want examples to look at? Most of the Python standard library is written in Python so t

Re: [Tutor] Help Optimise Code

2008-12-04 Thread Kent Johnson
On Thu, Dec 4, 2008 at 11:38 AM, Jörg Wölke <[EMAIL PROTECTED]> wrote: > #!/usr/bin/env python > > l=1*[1] > for i in range(2,len(l)): >if l[i] == 1: > print i > for j in range(i+1,len(l)): > if j%i == 0: for j in range(2*i, len(l), i): would be much faster

Re: [Tutor] Help Optimise Code

2008-12-04 Thread J�rg W�lke
* Richard Lovely <[EMAIL PROTECTED]> [081123 11:35]: > I've tried a the sieve of erath-whatever as in test_generator, > implemented using itertools functions, but it hit max recusion depth > somewhere before 1000 primes, and I'm after millions of primes. I found an old implementation for some exer

Re: [Tutor] Help Optimise Code

2008-11-21 Thread Kent Johnson
On Wed, Nov 19, 2008 at 8:13 AM, Richard Lovely <[EMAIL PROTECTED]> wrote: > Please don't suggest changing languages. I like python. Although if > you want to write an extension for me, and provide the source and a > makefile, please feel free. I have a MinGW install that's doing > nothing. (Just

Re: [Tutor] Help Optimise Code

2008-11-21 Thread Rich Lovely
On a small side note, the docs say array.array is supposed to be efficient. Testing has shown in this function, a list is faster (at least for x<10). A set is faster still - at least over the same range on my computer,, but you can't guarantee ordering, which makes it inconsistent - an

Re: [Tutor] Help Optimise Code

2008-11-19 Thread Lie Ryan
On Wed, 19 Nov 2008 13:13:18 +, Richard Lovely wrote: > I'm pretty new to code optimisation, so I thought I'd ask you all for > advice. > > I'm making an iterative prime number generator. This is what I've got so > far: > > Code: Select all > import math, array > > def count2(start_at=0): >

Re: [Tutor] Help Optimise Code

2008-11-19 Thread Kent Johnson
On Wed, Nov 19, 2008 at 8:13 AM, Richard Lovely <[EMAIL PROTECTED]> wrote: > I'm pretty new to code optimisation, so I thought I'd ask you all for advice. > > I'm making an iterative prime number generator. You might be interested in this recipe and discussion: http://code.activestate.com/recipes

Re: [Tutor] Help Python String Search

2008-10-06 Thread Kent Johnson
On Mon, Oct 6, 2008 at 5:37 PM, Deitemeyer, Adam R <[EMAIL PROTECTED]> wrote: > Hello, > > I'm a beginner Python user and I have simple python issue I can't seem to > solve. I want to do a truth test on a string to see if a another string is > contained within it. I found that typically the re mo

Re: [Tutor] Help Python String Search

2008-10-06 Thread John Fouhy
2008/10/7 Deitemeyer, Adam R <[EMAIL PROTECTED]>: > I'm a beginner Python user and I have simple python issue I can't seem to > solve. I want to do a truth test on a string to see if a another string is > contained within it. I found that typically the re module has the methods > to accomplish th

Re: [Tutor] Help reproing IDLE bug 3841? esp. on Windows Vista, XP

2008-09-19 Thread W W
Well, I know it doesn't repro with python 2.5 on ubuntu 8.04. -Wayne On Fri, Sep 19, 2008 at 4:49 AM, Stephen McInerney <[EMAIL PROTECTED]>wrote: > Could anyone help reproing this minor IDLE bug? > http://bugs.python.org/issue3841 > I found it on Windows Vista with Python 2.5 / IDLE 1.2.2. > Othe

Re: [Tutor] Help with checking for a data type

2008-09-04 Thread Spencer Parker
Those worked for me...thanks again!!! On Thu, Sep 4, 2008 at 3:26 PM, Kent Johnson <[EMAIL PROTECTED]> wrote: > On Thu, Sep 4, 2008 at 4:56 PM, Spencer Parker <[EMAIL PROTECTED]> > wrote: > > I have a script that is taking a directory list, the script then splits > the > > name up by the hyphens

Re: [Tutor] Help with checking for a data type

2008-09-04 Thread Kent Johnson
On Thu, Sep 4, 2008 at 4:56 PM, Spencer Parker <[EMAIL PROTECTED]> wrote: > I have a script that is taking a directory list, the script then splits the > name up by the hyphens in the name. The first part of the name should be a > number, but it isn't always a number. Is there a way to say: if it

Re: [Tutor] Help with checking for a data type

2008-09-04 Thread christopher . henk
try and convert the first value in the split list to a int (or float), if that works then post the value. if it throws an exception (ValueError) then catch that and pass, or do whatever else needs doing with the listing. def postData(inputData): fields=inputData.split("-") try: n

Re: [Tutor] help with sorted()

2008-08-19 Thread Emile van Sebille
Rick Pasotto wrote: I have a dictionary that looks like: d = {k:[v1,[v2,v3,v4]]} v1,v2,v3,v4 are integers. I want to print the dictionary sorted by v1, high to low. sorted(d,operator.itemgetter(0),reverse=True) You need to pass a compare function in... try for ii in sorted(d,lambda ii,jj: c

Re: [Tutor] help with sorted()

2008-08-17 Thread Kent Johnson
On 8/17/08, Rick Pasotto <[EMAIL PROTECTED]> wrote: > I have a dictionary that looks like: d = {k:[v1,[v2,v3,v4]]} > > v1,v2,v3,v4 are integers. > > I want to print the dictionary sorted by v1, high to low. Do you want just the keys, or the key/value pairs, or what? > sorted(d,operator.itemgetter

Re: [Tutor] help with augumented assignment y += 1

2008-07-30 Thread Emile van Sebille
Norman Khine wrote: Hi, Appologies, there was a typo, in that the first line is: ['1'] ['a1', 'a2', 'a2', 'a2'] [1, 1, 2, 4] Yes -- that helps. So, working from your xml samples, by doing something like: responses = [ [a,b,c] for a,b,c in responseAnalysisGenerator ] you can end up with resp

Re: [Tutor] help with augumented assignment y += 1

2008-07-30 Thread Norman Khine
Hi, Appologies, there was a typo, in that the first line is: ['1'] ['a1', 'a2', 'a2', 'a2'] [1, 1, 2, 4] The way the first line relates to the survey is such that, it looks at the response.xml file and returns what the individual user has submitted. So that: ['1'] ['a1', 'a2', 'a2', 'a2'] [1, 1

Re: [Tutor] help with augumented assignment y += 1

2008-07-30 Thread Emile van Sebille
Norman Khine wrote: Hello, I am writing a poll application, which has two XML files: Is this entire question consistent? I ask because when you get to asking your question below, it sounds like you're trying to tie together two outputs: > This returns: > ['1'] ['1', '2', '2', '2'] [1, 1

Re: [Tutor] help for building tui?

2008-07-04 Thread Alan Gauld
"Dong Li" <[EMAIL PROTECTED]> wrote If I want to create a text user interface for my application, is there any existed module to facilitate such building? Yes, Python includes the cmd module which is a framework for a menu driven command line. It is very like the help system that Python uses

Re: [Tutor] help for building tui?

2008-07-03 Thread Wolfram Kraus
Am 04.07.2008 08:33, Dong Li schrieb: Hi, everyone If I want to create a text user interface for my application, is there any existed module to facilitate such building? Yes, there is curses: http://docs.python.org/lib/module-curses.html http://www.amk.ca/python/howto/curses/ HTH, Wolfram

Re: [Tutor] Help! Character conversion from a rtf file.

2008-06-20 Thread wesley chun
> I'd like to learn the language by writing some simple programs rather than > keep reading books. My first program will convert certain uni-code characters > (let's say UTF-8) in an RTF file format based on a certain mapping > in another RTF file that is called a "RTF Control file". > : > The

Re: [Tutor] Help! Character conversion from a rtf file.

2008-06-20 Thread bob gailer
Chien Nguyen wrote: Hi All, I am a newbie to Python. I just did some readings on the web and got some basic understanding about the language. I'd like to learn the language by writing some simple programs rather than keep reading books. My first program will convert certain uni-code characters

Re: [Tutor] Help! Character conversion from a rtf file.

2008-06-20 Thread Kent Johnson
On Fri, Jun 20, 2008 at 12:46 PM, Chien Nguyen <[EMAIL PROTECTED]> wrote: > Hi All, > I am a newbie to Python. I just did some readings on the web > and got some basic understanding about the language. I'd like > to learn the language by writing some simple programs rather than > keep reading books

Re: [Tutor] Help python coding not working

2008-06-11 Thread Evans Anyokwu
Just like you'd add any other button on your web page -- Evans On Wed, Jun 11, 2008 at 8:49 AM, Mfana-boy Msibi <[EMAIL PROTECTED]> wrote: > How to add a delete button in your web page in Python > > > > > __ Information from ESET NOD32 Antivirus, version of virus > signature database 31

Re: [Tutor] Help with class.self variables

2008-05-14 Thread Kent Johnson
On Wed, May 14, 2008 at 3:45 AM, Mark <[EMAIL PROTECTED]> wrote: > i want to set the keys of the user row as the keys of User self > but i m not sure how to do it > > for i in self._user.keys(): > self[i]=self._user[i] Should be setattr(self, i, self._user[i]) > You ca

Re: [Tutor] Help with Recurring Function

2008-04-27 Thread Sanhita Mallick
Hi Alan. Thanks a lot. It worked > -- > > Message: 2 > Date: Sat, 26 Apr 2008 13:46:39 +0100 > From: "Alan Gauld" <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Help with Recurring Function > To: tutor@python.org > Messag

Re: [Tutor] Help with Recurring Function

2008-04-26 Thread Alan Gauld
"Sanhita Mallick" <[EMAIL PROTECTED]> wrote being calculated correctly as checked by the "print" statement. But when we do norm_ted = (2 * ted) / mag It might be an integer division issue. Try norm_ted = (2*ted) / float(mag) Just a thought... -- Alan Gauld Author of the Learn to

Re: [Tutor] Help with Recurring Function

2008-04-26 Thread Sanhita Mallick
Hi Kent. sum_norm_ted is sum over each i, and all j. That is why it is initialize to zero at the beginning of each i loop. The inner loop IS running - which I checked by all the print statements. The value of "ted" and "mag" ARE being calculated correctly as checked by the "print" statement. But

Re: [Tutor] Help with Recurring Function

2008-04-25 Thread Kent Johnson
Sanhita Mallick wrote: I am struggling with a simple recurring function What is a recurring function? Do you mean looping? Here is the script. T(i) are trees (as in graphs). The program operates great, until the step where norm_ted is calculated. Mysteriously norm_ted becomes 0, even though

Re: [Tutor] Help with Recurring Function

2008-04-25 Thread bob gailer
Sanhita Mallick wrote: Hi. I am struggling with a simple recurring function, but can't understand why this is happening. Please help. Here is the script. T(i) are trees (as in graphs). The program operates great, until the step where norm_ted is calculated. Mysteriously norm_ted becomes 0, even

Re: [Tutor] HELP!!!!!

2008-04-17 Thread Alan Gauld
"Michael Kim" <[EMAIL PROTECTED]> wrote > Hi I am having a really hard time making my tictactoe program work. > I > was wondering if you could could check it out and help me with the > error. Thanks Like to give us a clue as to what the error is? And include the error message if there is one p

Re: [Tutor] HELP!!!!!

2008-04-17 Thread Chris Calloway
On 4/17/2008 3:40 AM, Michael Kim wrote: > Hi I am having a really hard time making my tictactoe program work. I > was wondering if you could could check it out and help me with the > error. Thanks Heh. First, there are two obvious indentation errors you can find yourself. This may be a bypr

Re: [Tutor] HELP!!!!!

2008-04-17 Thread bob gailer
Michael Kim wrote: > Hi I am having a really hard time making my tictactoe program work. I > was wondering if you could could check it out and help me with the > error. Thanks > As Kent pointed out, we need to see the error you are getting in order to help. That usually shows up as a trace

Re: [Tutor] HELP!!!!!

2008-04-17 Thread Kent Johnson
Michael Kim wrote: > Hi I am having a really hard time making my tictactoe program work. I > was wondering if you could could check it out and help me with the > error. Thanks What is the error? Kent ___ Tutor maillist - Tutor@python.org http://ma

Re: [Tutor] Help with tutor@python.org

2008-04-16 Thread bob gailer
Thanks to all. My posts do show up. Now how to get them sent to me??? -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] help with slice

2008-04-02 Thread John
Thanks all for the posts, I guess I'm thinking in 'matrices' and in a matlab syntax. So I was trying to get the third element of a list of lists, or lists in a dictionay in syntax like matlab (yes, I should be using numpy or scipy). Anyway, Alan's final suggestion (and everyone else's) has helped

Re: [Tutor] Help Writing a Bill Calculating Program

2008-03-28 Thread bhaaluu
On Fri, Mar 28, 2008 at 12:50 AM, Amin Han <[EMAIL PROTECTED]> wrote: > Hi, I'm currently a novice at Python, and I need help creating the > following program... > > # Write a program that asks the user to enter a package number and the > total number of hours spent online that month (you may as

Re: [Tutor] Help Writing a Bill Calculating Program

2008-03-28 Thread Andreas Kostyrka
Hint: When you want help with your homework, you should first try to program something. Pasting the requirements to this mailing list will not help you. Homeworks are there so that YOU learn something. Not that you can prove that you are capable to find someone that does it for you. Andreas Am Fr

Re: [Tutor] Help with input/output

2008-03-25 Thread Kent Johnson
Olexander wrote: > Hello, > > please could you help me with input processing for olympiad problems. Do you know how to read and write files? This is covered in every Python book and tutorial. What have you tried? What problems are you having? > I also wonder how to output several integers in o

Re: [Tutor] Help this newbie

2008-03-21 Thread Alan Gauld
"Elliot Silvers" <[EMAIL PROTECTED]> wrote > I am as new as you can get to Python. I have just learned > how to save my work (very simple work of course). > I created a folder on C:\ (in this case C:\Elliot) for my work. > I am able to use the cmd prompt to run it Congratulations. You should

Re: [Tutor] Help this newbie

2008-03-20 Thread tiger12506
This is Windows I presume? Try: cd\python25 python C:\Elliot\filename.py But for windows you shouldn't have to. You can just double-click the file. On the other hand, if you mean 'import' as it means in the context of the actual python language, then you would put the line "import filename" at

Re: [Tutor] Help with a loop

2008-03-18 Thread Kent Johnson
PyProg PyProg wrote: > Hello, > > I have a little problem, I have two lists: > a=[1, 2, 3, 4, 5, 6] b=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] > > ... and I want to obtain: > [('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5), ('f', 6), ('g', > 1), ('h', 2), ('i', 3), ('

Re: [Tutor] Help with a loop

2008-03-18 Thread Andreas Kostyrka
Assuming that len(b) > len(a): >>> zip(itertools.cycle(a), b) [(1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f'), (1, 'g'), (2, 'h'), (3, 'i'), (4, 'j')] Andreas Am Dienstag, den 18.03.2008, 16:23 +0100 schrieb PyProg PyProg: > Hello, > > I have a little problem, I have two lists: >

Re: [Tutor] help with slice

2008-03-04 Thread Alan Gauld
"Ole Henning Jensen" <[EMAIL PROTECTED]> wrote > What you need to do is loop all the way through your list and then > only > do something to every third element in the list That's not quite what the OP asked for, he wanted the third element from every sublist in the master list > This is an exa

Re: [Tutor] help with slice

2008-03-04 Thread Alan Gauld
"washakie" <[EMAIL PROTECTED]> wrote > Could someone please explain 'slices' also for dictionaries? So far as I know slices don;t work for dictionaries directly - dictionaries don't have the concept of order. However you could get a list of keys and apply a slice to that, although I'm not sure

Re: [Tutor] help with slice

2008-03-04 Thread bob gailer
bob gailer wrote: > washakie wrote: > >> Could someone please explain 'slices' also for dictionaries? >> >> basically, I'd like to know how you would call every 3rd element in a list >> of lists... >> Call? Do you mean that these elements are callable objects (e.g. functions) which you wa

Re: [Tutor] help with slice

2008-03-04 Thread bob gailer
washakie wrote: > Could someone please explain 'slices' also for dictionaries? > > basically, I'd like to know how you would call every 3rd element in a list > of lists... > > My logic says: ThirdElems=List[:][2] > > Which to me reads, for every item in List (which are lists), return the > third i

Re: [Tutor] help with slice

2008-03-04 Thread Ole Henning Jensen
> Could someone please explain 'slices' also for dictionaries? > > basically, I'd like to know how you would call every 3rd element in a list > of lists... > > My logic says: ThirdElems=List[:][2] > What this does is, just assign the 3 value of List to the variable. look at this way, step by st

Re: [Tutor] help with slice

2008-03-04 Thread Andreas Kostyrka
What you probably want is: [elem_list[2] for elem_list in List] If you are not sure that the list have at least three elements, you can use something like this: [(elem_list + [None, None, None])[2] for elem_list in List] Which will use None as a default value. Andreas Am Dienstag, den 04.03.2

Re: [Tutor] help beginner in python.

2008-02-24 Thread Alan Gauld
"Krystle Scott" <[EMAIL PROTECTED]> wrote >i need to write an algorithm for computing square roots. We don;t do homework here but we can help with specific questions and to resolve errors. > import math > > def main (): > print " This program computes approximate square roots using > Newt

Re: [Tutor] help beginner in python.

2008-02-24 Thread Steve Willoughby
Krystle Scott wrote: > i need to write an algorithm for computing square roots. > so far I have This sounds like a class exercise. I think we can help you with Python questions, but you'll need to do the part that is directly related to your homework on your own. > import math > > def main ():

Re: [Tutor] help, thanks very much.

2008-01-16 Thread Kent Johnson
bill.wu wrote: > > i am new guy. > i ask a easy question. There is no need to ask twice. Please post messages in plain-text, not HTML. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] help, thanks very much.

2008-01-16 Thread Alan Gauld
"bill.wu" <[EMAIL PROTECTED]> wrote > i ask a easy question. > > why the first one have"x",the second one > doesn't have "x". what is different? The first is using x as the name of a parameter of the function and is only used inside the function. The second one takes no parameter and relies

Re: [Tutor] help, thanks very much.

2008-01-15 Thread Brendan Rankin
bill.wu gmail.com> writes: > > > > i am new guy. > i ask a easy question. > > why the first one have"x",the second one doesn't have "x". what > is different? when write "x",when don't write "x". > > in my point,the second one don't def variable. > > Variable scope. By declaring the

Re: [Tutor] help with list permutations

2008-01-04 Thread Kent Johnson
Chris Fuller wrote: > This is a good case for recursion. My solution is in two steps. > Here is the code: > > def recursion_is_your_friend(l): >if len(l) == 1: > return l >else: > return [ (i, recursion_is_your_friend(l[1:])) for i in l[0] ] > > l = recursion_is_your_friend([[

Re: [Tutor] help with list permutations

2008-01-03 Thread Chris Fuller
This is a good case for recursion. My solution is in two steps. A straightforward application of recursion (I was casting about semi-randomly) yields a attractive tree structure: root a b c d e c de f f f f ff g h

Re: [Tutor] help

2007-12-03 Thread bob gailer
Andrew Critchley wrote: > I recently downloaded the newer version of python, the 2.5.1 one, and > when ever i try to make an input what ever i type into the brackets > appears on the next line and when i try to add the next line it > carries on from the input,This is what happens: > > I type t

Re: [Tutor] Help with modulus.

2007-11-27 Thread Alan Gauld
"Luis N" <[EMAIL PROTECTED]> wrote > I'd like the below to be a single line if possible. Beware compression for the sake of it. However we can simplify a bit using divmod() > hours = metrics.totaltime/360 > minutes = (metrics.totaltime - 360*hours)/6 > seconds = (metrics.totaltime -

Re: [Tutor] Help with setting path

2007-11-03 Thread bhaaluu
Greetings, On 11/3/07, John <[EMAIL PROTECTED]> wrote: > Good point, I think that goes for learning a programming language in general > ;) Find one that works, and master it... > > I'm starting to put together the picture of what a Python installation is, > but I have to admit, when you work on mu

<    7   8   9   10   11   12   13   14   15   16   >