guessthenumber print games left

Chris Angelico rosuav at gmail.com
Wed Apr 10 18:31:19 EDT 2013


On Thu, Apr 11, 2013 at 7:01 AM,  <eschneider92 at comcast.net> wrote:
> On Wednesday, April 10, 2013 5:44:20 AM UTC-4, Chris Angelico wrote:
>> On Wed, Apr 10, 2013 at 7:39 PM,  <eschneider92 at comcast.net> wrote:
>>
>> You have here a counter, but it's counting up. To figure out how many
>> games are left, just subtract the numberofgames from the total number
>> of games that you'll be allowing - that's how many there are left. Do
>> you know how to do that?
>>
>
> Thanks for the quick reply. I've been trying your advice but I can't figure it out. If anyone could show me how to do it in program form, it would be much obliged.

Set your current code aside, and just make a program that counts games
without actually playing them. Start with this part of your existing
code:

numberofgames=1
while numberofgames<4:
    numberofgames=numberofgames+2

That will run, but do nothing. Now add a print call to the loop, and
see if you can work out how to make it count how many games are left.

If you get stuck, post the code for just this program and we'll see
where it takes us!

ChrisA



More information about the Python-list mailing list