Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75823

Re: Wikibooks example doesn't work

From John Gordon <gordon@panix.com>
Newsgroups comp.lang.python
Subject Re: Wikibooks example doesn't work
Date 2014-08-07 03:18 +0000
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <lrur6b$aog$1@reader1.panix.com> (permalink)
References <ilq5u9lfopj0g8227i5ko9s0lhn1ppcacm@4ax.com>

Show all headers | View raw


In <ilq5u9lfopj0g8227i5ko9s0lhn1ppcacm@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 guessed it right!")
>     elif guess < number:
>         print("It's bigger...")
>     elif guess > number:
>         print("It's not so big.")
>  
> if count > 3:
>     print("That must have been complicated.")
> else:
>     print("Good job!")

> http://en.wikibooks.org/wiki/Non-Programmer%27s_Tutorial_for_Python_3/Decisions

> 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.

It would help tremendously if you gave us more detail than "it doesn't
work".

Do you get an error message?
Does the program not execute at all?
Does it execute, but give unexpected results?

-- 
John Gordon         Imagine what it must be like for a real medical doctor to
gordon@panix.com    watch 'House', or a real serial killer to watch 'Dexter'.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Wikibooks example doesn't work Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-06 22:58 -0400
  Re: Wikibooks example doesn't work Chris Angelico <rosuav@gmail.com> - 2014-08-07 13:11 +1000
  Re: Wikibooks example doesn't work John Gordon <gordon@panix.com> - 2014-08-07 03:18 +0000
  Re: Wikibooks example doesn't work Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-06 23:25 -0400
    Re: Wikibooks example doesn't work Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-07 13:43 +1000
      Re: Wikibooks example doesn't work Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-06 23:48 -0400
        Re: Wikibooks example doesn't work Larry Hudson <orgnut@yahoo.com> - 2014-08-06 21:59 -0700
          Re: Wikibooks example doesn't work Ben Finney <ben+python@benfinney.id.au> - 2014-08-07 15:06 +1000
          Re: Wikibooks example doesn't work Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-07 11:11 -0400
    Re: Wikibooks example doesn't work alex23 <wuwei23@gmail.com> - 2014-08-07 14:09 +1000
    RE: Wikibooks example doesn't work8 Andrew Christianson <Andrew.Christianson@Ipsos.com> - 2014-08-07 03:43 +0000
  Re: Wikibooks example doesn't work Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-07 13:31 +1000

csiph-web