NumberGame in the python course


#1

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.


#2

Is this the project to which you are referring?

Number Guess


#3

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


#4

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


#5

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

    if user_guess > total_roll:

to

if user_guess == total_roll:

as the lesson text would clearly imply.

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

#6

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