Re: [Tutor] One of my 'baby step' programs

2006-10-02 Thread John Fouhy
On 03/10/06, Alan Gilfoy <[EMAIL PROTECTED]> wrote: > > for i in range(10): > > ... break > > ... else: > > ... print 'foo' > > ... > for i in range(10): > > ... pass > > ... else: > > ... print 'foo' > > ... > > foo > > > pardon the newb question, but what do these code lines do

Re: [Tutor] One of my 'baby step' programs

2006-10-02 Thread Kent Johnson
Luke Paireepinart wrote: > Alan Gilfoy wrote: >> -code block- >> >> number = 3 >> running = True >> >> while running: >>guess = int(raw_input("Please enter a number : ")) #lets user guess a >> number >> >>if guess == number: >>print "Yay, you got the right number, good for you. But

Re: [Tutor] One of my 'baby step' programs

2006-10-01 Thread Dick Moores
At 09:49 PM 10/1/2006, Luke Paireepinart wrote: I had no idea you could have an 'else' tied to a 'while' loop. Interesting I looked this up in Python in a Nutshell. From p. 69: The else Clause on Loop Statements while and for statements may optionally have a trailing else clause. The statemen

Re: [Tutor] One of my 'baby step' programs

2006-10-01 Thread John Fouhy
On 02/10/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > I had no idea you could have an 'else' tied to a 'while' loop. > Interesting It allows you to distinguish between exiting the loop via a break and exiting the loop normally. eg: >>> for i in range(10): ... break ... else: ... prin

Re: [Tutor] One of my 'baby step' programs

2006-10-01 Thread Luke Paireepinart
Alan Gilfoy wrote: > -code block- > > number = 3 > running = True > > while running: >guess = int(raw_input("Please enter a number : ")) #lets user guess a > number > >if guess == number: >print "Yay, you got the right number, good for you. But you > don't get any prizes. Do I loo

[Tutor] One of my 'baby step' programs

2006-10-01 Thread Alan Gilfoy
-code block- number = 3 running = True while running: guess = int(raw_input("Please enter a number : ")) #lets user guess a number if guess == number: print "Yay, you got the right number, good for you. But you don't get any prizes. Do I look like a walking ATM to you?" runn