Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Danny Yoo
> input = open('/home/tom/Python/Input/SPY3.txt', 'r') > N=0 > s = 'boo' > date =[] > T = [0,0,0,0,0,0] #don't know why this is necessary ^ Ok, let's talk about that comment there. Why six zeros? __

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Tom Strickland
Danny, Here's the working program. Tom * #!/usr/bin/python2.4 input = open('/home/tom/Python/Input/SPY3.txt', 'r') N=0 s = 'boo' date =[] T = [0,0,0,0,0,0] #don't know why this is necessary ope

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Danny Yoo
On Tue, 23 Aug 2005, Tom Strickland wrote: > I changed the program in accordance with your advice and it now runs > perfectly!!! Hi Tom, That's very good to hear; glad it's working now. If you don't mind, can you post up what you have now? I left out some other suggestions to the program bec

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Tom Strickland
Danny, I changed the program in accordance with your advice and it now runs perfectly!!! Thanks for the education! Tom Strickland Danny Yoo wrote: >[Danny] > > >>>Anyway, this doesn't answer the problem: how do we add elements to a >>>list? In Python, we can accumulate elements in a list by

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Danny Yoo
[Danny] > >Anyway, this doesn't answer the problem: how do we add elements to a > >list? In Python, we can accumulate elements in a list by append()ing: [code cut] [Tom] > So, for example, would I use the following in my "while" loop: > > date.append(T[N][0]) > > Before th

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Tom Strickland
Danny, Thanks for your comments and your help. I've added my comments to your text below. Hopefully it will be in red so you can easily identify them. Tom Danny Yoo wrote: >Hi Tom, > >Before we continue: it looks like you're starting to learn Python. Have >you gone through one of the tutorial

[Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Danny Yoo
Hi Tom, Before we continue: it looks like you're starting to learn Python. Have you gone through one of the tutorials here? http://wiki.python.org/moin/BeginnersGuide/NonProgrammers Alan Gauld's tutorial is especially nice, but all of the tutorials there should be useful. If you go throug