Re: First python program, syntax error in while loop

2013-05-07 Thread Chris Angelico
On Tue, May 7, 2013 at 10:44 PM, Ombongi Moraa Fe wrote: > My first language was Pascal. It was at a time in 2005 when computers were > finally becoming popular in Africa and our year was the first time a girls > school from our Province did a computer coursework for National Exams. (That > was su

Re: First python program, syntax error in while loop

2013-05-07 Thread Chris Angelico
On Tue, May 7, 2013 at 4:10 PM, Mark Lawrence wrote: > On 07/05/2013 01:17, alex23 wrote: >> >> On May 6, 10:37 pm, Mark Lawrence wrote: >>> >>> One of these days I'll work out why some people insist on using >>> superfluous parentheses in Python code. Could it be that they enjoy >>> exercising

Re: First python program, syntax error in while loop

2013-05-06 Thread Mark Lawrence
On 07/05/2013 01:17, alex23 wrote: On May 6, 10:37 pm, Mark Lawrence wrote: One of these days I'll work out why some people insist on using superfluous parentheses in Python code. Could it be that they enjoy exercising their fingers by reaching for the shift key in conjunction with the 9 or 0

Re: First python program, syntax error in while loop

2013-05-06 Thread Dan Sommers
On Mon, 06 May 2013 17:17:01 -0700, alex23 wrote: > One of these days I'll work out why some programmers consider typing to > be "effort". An ironic comment from someone who goes by the moniker wu wei! ;-) The effort, of course, comes in determining what to type, and often how to type less. --

Re: First python program, syntax error in while loop

2013-05-06 Thread Roy Smith
In article , alex23 wrote: > On May 6, 10:37 pm, Mark Lawrence wrote: > > One of these days I'll work out why some people insist on using > > superfluous parentheses in Python code.  Could it be that they enjoy > > exercising their fingers by reaching for the shift key in conjunction > > with

Re: First python program, syntax error in while loop

2013-05-06 Thread alex23
On May 6, 10:37 pm, Mark Lawrence wrote: > One of these days I'll work out why some people insist on using > superfluous parentheses in Python code.  Could it be that they enjoy > exercising their fingers by reaching for the shift key in conjunction > with the 9 or 0 key? One of these days I'll w

Re: First python program, syntax error in while loop

2013-05-06 Thread Chris Angelico
On Tue, May 7, 2013 at 6:11 AM, Terry Jan Reedy wrote: > On 5/6/2013 11:31 AM, Roy Smith wrote: >> >> In article , >> Chris Angelico wrote: >>> If I ever have even the slightest doubt, I just go ahead and type >>> " operator precedence" into a web search and check it :) >> >> >> Well, that solve

Re: First python program, syntax error in while loop

2013-05-06 Thread Terry Jan Reedy
On 5/6/2013 11:31 AM, Roy Smith wrote: In article , Chris Angelico wrote: On Mon, May 6, 2013 at 11:08 PM, Roy Smith wrote: On the other hand, I've long since given up trying to remember operator precedence in various languages. If I ever have even the slightest doubt, I just go ahead and p

Re: First python program, syntax error in while loop

2013-05-06 Thread Roy Smith
In article , Chris Angelico wrote: >On Mon, May 6, 2013 at 11:08 PM, Roy Smith wrote: >> On the other hand, I've long since given up trying to remember operator >> precedence in various languages. If I ever have even the slightest >> doubt, I just go ahead and put in the extra parens. > >If I e

Re: First python program, syntax error in while loop

2013-05-06 Thread rusi
On May 6, 6:08 pm, Roy Smith wrote: > BTW, in C, I used to write: > > return (foo) > > for years until somebody pointed out to me that > > return foo > > works.  I just assumed that if I had to write: > > if (foo) > while (foo) > for (foo; bar; baz) > > then > > return (foo) > > made sense too.

Re: First python program, syntax error in while loop

2013-05-06 Thread Chris Angelico
On Mon, May 6, 2013 at 11:08 PM, Roy Smith wrote: > On the other hand, I've long since given up trying to remember operator > precedence in various languages. If I ever have even the slightest > doubt, I just go ahead and put in the extra parens. If I ever have even the slightest doubt, I just g

Re: First python program, syntax error in while loop

2013-05-06 Thread Roy Smith
In article , Mark Lawrence wrote: > > while (number != guess) and (tries < 5): > > One of these days I'll work out why some people insist on using > superfluous parentheses in Python code. Could it be that they enjoy > exercising their fingers by reaching for the shift key in conjunction >

Re: First python program, syntax error in while loop

2013-05-06 Thread Neil Cerutti
On 2013-05-06, Mark Lawrence wrote: > On 06/05/2013 13:06, Neil Cerutti wrote: >> On 2013-05-03, John Gordon wrote: >>> In Neil Cerutti >>> writes: >>> Not quite yet. Players who guess correctly on the fifth try don't get credit. >>> >>> Are you sure? tries is initialized to zero an

Re: First python program, syntax error in while loop

2013-05-06 Thread Mark Lawrence
On 06/05/2013 13:06, Neil Cerutti wrote: On 2013-05-03, John Gordon wrote: In Neil Cerutti writes: Not quite yet. Players who guess correctly on the fifth try don't get credit. Are you sure? tries is initialized to zero and isn't incremented for the initial guess. while (number != gues

Re: First python program, syntax error in while loop

2013-05-06 Thread Neil Cerutti
On 2013-05-03, John Gordon wrote: > In Neil Cerutti writes: > >> Not quite yet. Players who guess correctly on the fifth try don't >> get credit. > > Are you sure? tries is initialized to zero and isn't > incremented for the initial guess. while (number != guess) and (tries < 5): Is the condi

Re: First python program, syntax error in while loop

2013-05-03 Thread John Gordon
In Neil Cerutti writes: > Not quite yet. Players who guess correctly on the fifth try don't > get credit. Are you sure? tries is initialized to zero and isn't incremented for the initial guess. -- John Gordon A is for Amy, who fell down the stairs gor...@panix.com

Re: First python program, syntax error in while loop

2013-05-03 Thread Neil Cerutti
On 2013-05-03, ryankoc...@gmail.com wrote: > Thank you! It's 100% functional now, here's the final project: > > title = "Guess my number game:" > print title.title() > raw_input("Press any key to continue..") > > import random > > number = random.randrange(99) + 1 > tries = 0 > guess = int(r

Re: First python program, syntax error in while loop

2013-05-03 Thread ryankoch38
Thank you! It's 100% functional now, here's the final project: title = "Guess my number game:" print title.title() raw_input("Press any key to continue..") import random number = random.randrange(99) + 1 tries = 0 guess = int(raw_input("Guess my number! Secret - It is between 1 and 100 :")

Re: First python program, syntax error in while loop

2013-05-03 Thread John Gordon
In ryankoc...@gmail.com writes: > I've got it working! I'm really enjoying python :) But now i'd like to make > it break out of the while loop when the user guesses more than 5 numbers and > fails The "Congratulations" message is inside the while loop; that's why it always prints. To break a

Re: First python program, syntax error in while loop

2013-05-03 Thread ryankoch38
I've got it working! I'm really enjoying python :) But now i'd like to make it break out of the while loop when the user guesses more than 5 numbers and fails.. title = "Guess my number game:" print title.title() raw_input("Press any key to continue..") import random number = random.randra

Re: First python program, syntax error in while loop

2013-05-03 Thread ryankoch38
Oh wow I can't believed I derped that hard Thanks Lol. -- http://mail.python.org/mailman/listinfo/python-list

Re: First python program, syntax error in while loop

2013-05-03 Thread John Gordon
In <02b65e11-89c6-4639-9d93-27e1f90ee...@googlegroups.com> ryankoc...@gmail.com writes: > Okay, thank you very much for the timely replies, heres what i have now: > title = "Guess my number game:" > print title.title() > raw_input("Press any key to continue..") > import random > number = rando

Re: First python program, syntax error in while loop

2013-05-03 Thread ryankoch38
Okay, thank you very much for the timely replies, heres what i have now: title = "Guess my number game:" print title.title() raw_input("Press any key to continue..") import random number = random.randrange(99) + 1 tries = 0 guess = int(raw_input("Guess my number! Secret - It is between 1 and 100

Re: First python program, syntax error in while loop

2013-05-03 Thread Zachary Ware
On Fri, May 3, 2013 at 12:18 PM, wrote: > title = "Guess my number game:" > print title.title() > raw_input("Press any key to continue..") > > import random > > tries = 0 > number = random.randrange(99) + 1 > guess = int(raw_input("Guess my number! Secret - It is between 1 and 100 :") First up,

Re: First python program, syntax error in while loop

2013-05-03 Thread John Gordon
In =?UTF-8?B?Q2hyaXMg4oCcS3dwb2xza2HigJ0gV2Fycmljaw==?= writes: > 1. post full tracebacks. I almost responded with the same advice, but in this case the full traceback doesn't really tell us anything more: File "foo.py", line 11 while guess != number: ^ SyntaxEr

Re: First python program, syntax error in while loop

2013-05-03 Thread MRAB
On 03/05/2013 18:18, ryankoc...@gmail.com wrote: title = "Guess my number game:" print title.title() raw_input("Press any key to continue..") import random tries = 0 number = random.randrange(99) + 1 guess = int(raw_input("Guess my number! Secret - It is between 1 and 100 :") while (guess != n

Re: First python program, syntax error in while loop

2013-05-03 Thread John Gordon
In <24c5856e-a30a-41bd-aa4a-0e594734e...@googlegroups.com> ryankoc...@gmail.com writes: > title = "Guess my number game:" > print title.title() > raw_input("Press any key to continue..") > import random > tries = 0 > number = random.randrange(99) + 1 > guess = int(raw_input("Guess my number! Se

Re: First python program, syntax error in while loop

2013-05-03 Thread Chris “Kwpolska” Warrick
On Fri, May 3, 2013 at 7:18 PM, wrote: > title = "Guess my number game:" > print title.title() > raw_input("Press any key to continue..") > > import random > > tries = 0 > number = random.randrange(99) + 1 > guess = int(raw_input("Guess my number! Secret - It is between 1 and 100 :") > > while (g