NumberGame in the python course


In the number_game of python course if we guess the number as 11 or 12 the user always win. What the solution to this? Because by entering 11 or 12 the computer mostly guess the number less than 12 and so chances of user winning increases greatly.


Is this the project to which you are referring?

Number Guess


Yes sir. in this game whenever we enter 11 or 12 as user guess the chances of winning are almost 100% bcoz the computer can’t generate a random integer greater than 12


The introduction text (at the top) describes much more reasonable rules, so, yes, someone clearly messed up.


Earn all the checkmarks for the exercise, then go back and change this one line…

    if user_guess > total_roll:


if user_guess == total_roll:

as the lesson text would clearly imply.

$ python
Maximum Value: 12
User Guess: 10
First roll: 6
Second roll: 4
Congratulations. You win!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.