Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76764
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.023 |
| X-Spam-Evidence | '*H*': 0.95; '*S*': 0.00; '2004': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'restart': 0.09; 'subject:How': 0.10; 'clear.': 0.16; 'finney': 0.16; 'give.': 0.16; 'guess.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'semantics': 0.16; 'statement.': 0.16; 'subject:question.': 0.16; 'subject:start': 0.16; 'code.': 0.18; 'print': 0.22; 'header:User-Agent:1': 0.23; 'gets': 0.27; 'header:X-Complaints-To:1': 0.27; 'tried': 0.27; 'correct': 0.29; 'code': 0.31; 'writes:': 0.31; 'says': 0.33; 'url:python': 0.33; 'guess': 0.33; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'are,': 0.36; 'doing': 0.36; 'subject:?': 0.36; 'url:org': 0.36; 'should': 0.36; 'expected': 0.38; 'ben': 0.38; 'to:addr:python- list': 0.38; 'rather': 0.38; 'that,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'free': 0.61; 'url:3': 0.61; 'skip:* 10': 0.61; 'further': 0.61; "you've": 0.63; 'here': 0.66; '8bit%:21': 0.69; 'received:125': 0.84; 'subject:. ': 0.84; 'subject:Very': 0.84; 'url:reference': 0.84; 'faith': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Ben Finney <ben+python@benfinney.id.au> |
| Subject | Re: Very basic question. How do I start again? |
| Date | Fri, 22 Aug 2014 11:55:58 +1000 |
| References | <1e5dv9l3aik5bb1jn4vil731rdl7q6sl3l@4ax.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| X-Gmane-NNTP-Posting-Host | jigong.madmonks.org |
| X-Public-Key-ID | 0xAC128405 |
| X-Public-Key-Fingerprint | 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 |
| X-Public-Key-URL | http://www.benfinney.id.au/contact/bfinney-pubkey.asc |
| X-Post-From | Ben Finney <bignose+hates-spam@benfinney.id.au> |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
| Cancel-Lock | sha1:R+DQljO5YnjUv5C/nq/vXYiEnOg= |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13268.1408672574.18130.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1408672574 news.xs4all.nl 2845 [2001:888:2000:d::a6]:43671 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:76764 |
Show key headers only | View raw
Seymore4Head <Seymore4Head@Hotmail.invalid> writes:
> The program works as expected until the computer gets a correct guess.
> I don't know what I should be doing to restart the program when
> pick=guess.
There isn't a “restart the program” code we can give. But I think you
need only something rather simpler:
> while count < 100:
> guess = random.randrange(low,high)
> print (pick, guess)
> if guess == pick:
> print ("correct")
>
> #"What I need is something here that says start over"
You can end the current loop with the ‘break’ statement. See the docs
<URL:https://docs.python.org/3/reference/simple_stmts.html#the-break-statement>
to see exactly what its semantics are, and try using that in your code.
Feel free to ask further questions when you've tried that, if it's still
not clear.
--
\ “Religious faith is the one species of human ignorance that |
`\ will not admit of even the *possibility* of correction.” —Sam |
_o__) Harris, _The End of Faith_, 2004 |
Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Very basic question. How do I start again? Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-21 21:37 -0400
Re: Very basic question. How do I start again? Ben Finney <ben+python@benfinney.id.au> - 2014-08-22 11:55 +1000
Re: Very basic question. How do I start again? Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-21 22:13 -0400
Re: Very basic question. How do I start again? Chris Angelico <rosuav@gmail.com> - 2014-08-22 12:24 +1000
Re: Very basic question. How do I start again? Chris Angelico <rosuav@gmail.com> - 2014-08-22 11:58 +1000
Re: Very basic question. How do I start again? Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-08-21 22:18 -0400
Re: Very basic question. How do I start again? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-08-21 23:17 -0400
Re: Very basic question. How do I start again? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-22 12:58 +1000
Re: Very basic question. How do I start again? Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-22 04:26 +0000
Re: Very basic question. How do I start again? Tim Roberts <timr@probo.com> - 2014-08-21 22:56 -0700
Re: Very basic question. How do I start again? Igor Korot <ikorot01@gmail.com> - 2014-08-21 23:21 -0700
csiph-web