Re: Wikibooks example doesn't work

2014-08-07 Thread Seymore4Head
Seymore4Head@Hotmail.invalid wrote: [snip] Ah, now things make sense! Your subject line is misleading! It's not that the wikibooks example doesn't work, the example works fine. It's that the code you added to it doesn't do what you expected. You should have said. I copied it verbatim from the web

Wikibooks example doesn't work

2014-08-06 Thread Seymore4Head
number = 7 guess = -1 count = 0 print(Guess the number!) while guess != number: guess = int(input(Is it... )) count = count + 1 if guess == number: print(Hooray! You guessed it right!) elif guess number: print(It's bigger...) elif guess number:

Re: Wikibooks example doesn't work

2014-08-06 Thread Chris Angelico
On Thu, Aug 7, 2014 at 12:58 PM, Seymore4Head Seymore4Head@hotmail.invalid wrote: Why not? I think I know why it isn't working, but I don't know enough yet on how it should work. The If statement isn't getting read. One thing you need to learn about Python... or, for that matter, pretty much

Re: Wikibooks example doesn't work

2014-08-06 Thread John Gordon
In ilq5u9lfopj0g8227i5ko9s0lhn1ppc...@4ax.com Seymore4Head Seymore4Head@Hotmail.invalid writes: number = 7 guess = -1 count = 0 print(Guess the number!) while guess != number: guess = int(input(Is it... )) count = count + 1 if guess == number: print(Hooray! You

Re: Wikibooks example doesn't work

2014-08-06 Thread Seymore4Head
On Wed, 06 Aug 2014 22:58:51 -0400, Seymore4Head Seymore4Head@Hotmail.invalid wrote: number = 7 guess = -1 count = 0 print(Guess the number!) while guess != number: guess = int(input(Is it... )) count = count + 1 if guess == number: print(Hooray! You guessed it right!)

Re: Wikibooks example doesn't work

2014-08-06 Thread Steven D'Aprano
Seymore4Head wrote: [snip code that looks fine to me] Why not? I don't know. What does doesn't work mean? It didn't do what I expected. (What did you expect? What did it do?) It printed an error message. (Care to tell it what it was?) It crashed the computer. (Some more details might help.)

Re: Wikibooks example doesn't work

2014-08-06 Thread Steven D'Aprano
. Ah, now things make sense! Your subject line is misleading! It's not that the wikibooks example doesn't work, the example works fine. It's that the code you added to it doesn't do what you expected. You should have said. A counter is added to give 3 tries to guess the number. It is supposed

Re: Wikibooks example doesn't work

2014-08-06 Thread Seymore4Head
to guess at a number (7) with an infinite amount of tries. This part was added as an exercise. Ah, now things make sense! Your subject line is misleading! It's not that the wikibooks example doesn't work, the example works fine. It's that the code you added to it doesn't do what you expected. You

Re: Wikibooks example doesn't work

2014-08-06 Thread alex23
On 7/08/2014 1:25 PM, Seymore4Head wrote: This part was added as an exercise. A counter is added to give 3 tries to guess the number. It is supposed to stop after count gets to 3. It doesn't. It just keeps looping back and asking for another guess. You've misread the exercise: Modify the

Re: Wikibooks example doesn't work

2014-08-06 Thread Larry Hudson
subject line is misleading! It's not that the wikibooks example doesn't work, the example works fine. It's that the code you added to it doesn't do what you expected. You should have said. I copied it verbatim from the web page's solution. After indenting as you suggested, it does work now though

Re: Wikibooks example doesn't work

2014-08-06 Thread Ben Finney
Larry Hudson org...@yahoo.com.dmarc.invalid writes: I just took a look at that web page, and I see what your problem actually is... You are misunderstanding the problem. The problem does NOT say to end the loop at three tries, just to keep track of the number of tries. It's not actually