Top-rated recipes by Benoit http://code.activestate.com/recipes/users/4191135/top/2014-11-15T12:11:16-08:00ActiveState Code RecipesGuess a number 2 (the computer attempts to guess your number) (Python)
2014-11-15T12:11:16-08:00Benoithttp://code.activestate.com/recipes/users/4191135/http://code.activestate.com/recipes/578963-guess-a-number-2-the-computer-attempts-to-guess-yo/
<p style="color: grey">
Python
recipe 578963
by <a href="/recipes/users/4191135/">Benoit</a>
(<a href="/recipes/tags/ai/">ai</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/sample/">sample</a>).
Revision 2.
</p>
<p>Guess a number was part 1 was Human trying to guess a random number between 1 and 100 in 10 tries. This time the computer is trying to guess. Simple program for beginner to learn very simple formula as a start to an algorithm for AI. And conditional choice. The program is not perfect, as it will not force a victory when the computer guessed right, neither it can control if you cheated or not. But this is not the goal here. </p>
Guess a number (Python)
2014-11-15T09:06:05-08:00Benoithttp://code.activestate.com/recipes/users/4191135/http://code.activestate.com/recipes/578962-guess-a-number/
<p style="color: grey">
Python
recipe 578962
by <a href="/recipes/users/4191135/">Benoit</a>
(<a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/random/">random</a>, <a href="/recipes/tags/sample/">sample</a>).
</p>
<p>This is just a little game to explain some very basic function in Python for beginner. RANDOM, Loop, Try and except... </p>