Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #43317
| X-Received | by 10.224.58.77 with SMTP id f13mr3187118qah.7.1365658481574; Wed, 10 Apr 2013 22:34:41 -0700 (PDT) |
|---|---|
| X-Received | by 10.49.16.199 with SMTP id i7mr9201qed.0.1365658481485; Wed, 10 Apr 2013 22:34:41 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!t2no50217082qal.0!news-out.google.com!ef9ni18755qab.0!nntp.google.com!ca1no40733098qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Wed, 10 Apr 2013 22:34:41 -0700 (PDT) |
| In-Reply-To | <0e8b4a09-3d1d-4b92-a0ef-2274a2a651c9@googlegroups.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=68.38.30.68; posting-account=sLfkeQoAAAC9Lnlqp-6c6PVPFjrttJ3I |
| NNTP-Posting-Host | 68.38.30.68 |
| References | <0e8b4a09-3d1d-4b92-a0ef-2274a2a651c9@googlegroups.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <dbc15ed0-e3b8-4166-b9e5-1c287e39993b@googlegroups.com> (permalink) |
| Subject | Re: guessthenumber print games left |
| From | eschneider92@comcast.net |
| Injection-Date | Thu, 11 Apr 2013 05:34:41 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Xref | csiph.com comp.lang.python:43317 |
Show key headers only | View raw
On Wednesday, April 10, 2013 5:39:23 AM UTC-4, eschne...@comcast.net wrote:
> Could anyone tell me how to make the program tell me how many games are left before the first game and second game? For example, after one game of guess the number, I want it to tell me that i get one more game. P.S. I'm totally new to python (obviously), and I just added numberofgames variable in hopes of solving this problem. am I on the right track? Thanks for any assistance!
>
> numberofgames=1
>
> while numberofgames<4:
>
> numberofgames=numberofgames+2
>
> import random
>
> print ('type name')
>
> name=input()
>
> print ('guess a number between 1 and 20, ' + name)
>
> number=random.randint(1,20)
>
> guessestaken=0
>
> while guessestaken<5:
>
> guessestaken=guessestaken+1
>
> guess=input()
>
> guess=int(guess)
>
> if guess<number:
>
> print ('your guess is too low')
>
> if guess>number:
>
> print ('your guess is too high0')
>
> if guess==number:
>
> break
>
> if guess==number:
>
> print ('you win!')
>
> if guess!=number:
>
> number=str(number)
>
> print ('you lose. the number was ' + number)
I can't figure out how to make it count down by itself and state how many are left.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
guessthenumber print games left eschneider92@comcast.net - 2013-04-10 02:39 -0700
Re: guessthenumber print games left Chris Angelico <rosuav@gmail.com> - 2013-04-10 19:44 +1000
Re: guessthenumber print games left eschneider92@comcast.net - 2013-04-10 14:01 -0700
Re: guessthenumber print games left Chris Angelico <rosuav@gmail.com> - 2013-04-11 08:31 +1000
Re: guessthenumber print games left eschneider92@comcast.net - 2013-04-10 14:01 -0700
Re: guessthenumber print games left eschneider92@comcast.net - 2013-04-10 22:34 -0700
Re: guessthenumber print games left eschneider92@comcast.net - 2013-04-10 22:41 -0700
Re: guessthenumber print games left Chris Angelico <rosuav@gmail.com> - 2013-04-11 15:48 +1000
Re: guessthenumber print games left eschneider92@comcast.net - 2013-04-10 22:56 -0700
Re: guessthenumber print games left Chris Angelico <rosuav@gmail.com> - 2013-04-11 16:02 +1000
Re: guessthenumber print games left eschneider92@comcast.net - 2013-04-10 23:15 -0700
Re: guessthenumber print games left Chris Angelico <rosuav@gmail.com> - 2013-04-11 16:27 +1000
Re: guessthenumber print games left eschneider92@comcast.net - 2013-04-11 00:15 -0700
Re: guessthenumber print games left Chris Angelico <rosuav@gmail.com> - 2013-04-11 17:27 +1000
Re: guessthenumber print games left Neil Cerutti <neilc@norwich.edu> - 2013-04-11 12:31 +0000
csiph-web