guessthenumber print games left

Neil Cerutti neilc at norwich.edu
Thu Apr 11 08:31:56 EDT 2013


On 2013-04-11, eschneider92 at comcast.net
<eschneider92 at comcast.net> wrote:
> If you get the time, please post an example, because I don't
> understand.

Maybe it would help to think about contraints. Write them next to
your variable names, and then check, at every point in your
program, if the contraint is still true.

Here's and example.

maximum_games = 4  # You must stop playing after 4 games.
games_played = 0   # Always equals the number of games played
while games_played < maximum_games:
    play_game()
    # This is where you update games_played to reflect the number
    # of games played.
  
-- 
Neil Cerutti



More information about the Python-list mailing list