Re: [Tutor] Control flow

2005-01-31 Thread Gilbert Tsang
Thanks for the enthusiasm on how input/raw_input() works - my original intention was to ask a question on control flow so I didn't spend that much time testing out this piece of input code besides typing. But I did learn a lot. Thanks! Gilbert Jacob S. wrote: I noticed that too, Liam. b = input

Re: [Tutor] Control flow

2005-01-29 Thread Jacob S.
I noticed that too, Liam. b = input("Weather is really bad, still go out to jog? [y/n]") # Would it kill you to have whitespace in a prompt? should really be b = raw_input("Weather is really bad, still go out to jog? [y/n]") to get the effect he wants. input() doesn't only take integers,

Re: Fwd: [Tutor] Control flow

2005-01-29 Thread Orri Ganel
Kent Johnson wrote: Bob Gailer wrote: At 04:43 AM 1/29/2005, Liam Clarke wrote: < erk, to the list, to the List!> if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() Anyone else notice

Re: Fwd: [Tutor] Control flow

2005-01-29 Thread Kent Johnson
Bob Gailer wrote: At 04:43 AM 1/29/2005, Liam Clarke wrote: < erk, to the list, to the List!> if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() Anyone else notice that he's never gon

Re: Fwd: [Tutor] Control flow

2005-01-29 Thread Bob Gailer
At 04:43 AM 1/29/2005, Liam Clarke wrote: < erk, to the list, to the List!> if ( bad_weather =='y' ):    # ask user only if weather is bad.    b = input ( "Weather is really bad, still go out to jog?[y/n]" )    if b == 'y':   go_jogging() Anyone else notice that he's never gonna go jogging if

Fwd: [Tutor] Control flow

2005-01-29 Thread Liam Clarke
< erk, to the list, to the List!> if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() Anyone else notice that he's never gonna go jogging if the weather is bad? Unless I've got input

Re: [Tutor] Control flow

2005-01-28 Thread Alan Gauld
> One way out of the top level is to call > sys.exit(1) Which works, but you need to import sys first. Using raise SystemExit avoids the need for an import. Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tu

Re: [Tutor] Control flow

2005-01-28 Thread Alan Gauld
SEveral solutions here. The best is to restructure the code a little: > def go_jogging(): > # go out and jog > return > > if not bad_weather == 'y': # where is this initially set BTW? go_jogging() else > # ask user only if weather is bad. > b = input ( "Weather is really ba

RE: [Tutor] Control flow

2005-01-28 Thread Smith, Jeff
One way out of the top level is to call sys.exit(1) -Original Message- From: Orri Ganel [mailto:[EMAIL PROTECTED] Sent: Friday, January 28, 2005 4:26 PM To: Gilbert Tsang; Tutor@python.org Subject: Re: [Tutor] Control flow Gilbert Tsang wrote: > Hi there, I have this lo

Re: [Tutor] Control flow

2005-01-28 Thread Orri Ganel
Gilbert Tsang wrote: Hi there, I have this logic that I cannot wrap my mind it: def go_jogging(): # go out and jog return if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() e

Re: [Tutor] Control flow

2005-01-28 Thread Orri Ganel
Gilbert Tsang wrote: Hi there, I have this logic that I cannot wrap my mind it: def go_jogging(): # go out and jog return if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() e

[Tutor] Control flow

2005-01-28 Thread Gilbert Tsang
Hi there, I have this logic that I cannot wrap my mind it: def go_jogging(): # go out and jog return if ( bad_weather =='y' ): # ask user only if weather is bad. b = input ( "Weather is really bad, still go out to jog?[y/n]" ) if b == 'y': go_jogging() else: # program