Re: more newbie help needed

2005-11-15 Thread bruno at modulix
Steve Holden wrote: > john boy wrote: > >> using the following program: >> >> fruit = "banana" >> index = 0 >> while index < len (fruit): >> letter = fruit[index-1] >> print letter >> index= index -1 >> >> this program is supposed to spell "banana" backwards and in a vertical >

Re: more newbie help needed

2005-11-14 Thread Steve Holden
john boy wrote: [top-posting corrected] > > Steve Holden <[EMAIL PROTECTED]> wrote:john boy wrote: > >>using the following program: >> >>fruit = "banana" >>index = 0 >>while index < len (fruit): >>letter = fruit[index-1] >>print letter >>index= index -1 >> >>this program is supposed to spell "ban

Re: more newbie help needed

2005-11-14 Thread Fredrik Lundh
Craig Marshall wrote: > Or, if you're *really* just trying to reverse the string, then the > following might read more easily (although it's probably longer): > fruit = list(fruit) > fruit.reverse() > fruit = ''.join(fruit) same thing, on one line: fruit = "".join(reversed(fruit)) same thi

Re: more newbie help needed

2005-11-14 Thread Fredrik Lundh
Steve Holden wrote: > Note, however, that there are more pythonic ways to perform this task. > You might try: > > for index in range(len(fruit)): > letter = fruit[-index-1] > print letter > > as one example. I'm sure other readers will have their own ways to do > this, many of them more elegan

Re: more newbie help needed

2005-11-14 Thread Craig Marshall
> Note, however, that there are more pythonic ways to perform this task. > You might try: > > for index in range(len(fruit)): >letter = fruit[-index-1] >print letter Or, if you're *really* just trying to reverse the string, then the following might read more easily (although it's probably

Re: more newbie help needed

2005-11-14 Thread Fredrik Lundh
"john boy" <[EMAIL PROTECTED]> wrote: > using the following program: > > fruit = "banana" > index = 0 > while index < len (fruit): > letter = fruit[index-1] > print letter > index= index -1 > after spelling "banana" it gives an error message: > refering to line 4: letter = fruit[in

Re: more newbie help needed

2005-11-14 Thread Steve Holden
john boy wrote: > using the following program: > > fruit = "banana" > index = 0 > while index < len (fruit): > letter = fruit[index-1] > print letter > index= index -1 > > this program is supposed to spell "banana" backwards and in a vertical > patern...it does thisbut after

more newbie help needed

2005-11-14 Thread john boy
using the following program:   fruit = "banana" index = 0 while index < len (fruit): letter = fruit[index-1] print letter index= index -1   this program is supposed to spell "banana" backwards and in a vertical patern...it does thisbut after spelling "banana" it gives an error me

Re: newbie help needed

2005-11-14 Thread Fredrik Lundh
"john boy" <[EMAIL PROTECTED]> wrote: > I am running the following program: > > def print Multiples (n, high): > i = 1 > while i <= high: > print n*i, ' \t' , > i = i + 1 > print > def printMultTable (high): > i = 1 > while i <= high: > print Multip

newbie help needed

2005-11-14 Thread john boy
I am running the following program:   def print Multiples (n, high):     i = 1     while i <= high: print n*i, ' \t' , i = i + 1 print def printMultTable (high): i = 1 while i <= high: print Multiples (i, high) i = i + 1 printMultiples(8,8) printMul