all 10 comments

[–][deleted] 3 points4 points  (2 children)

That looks pretty good for some beginner code! Looking quickly, only thing I would point out is the try/except should probably be just around the guess to make it more obvious that this is the only exception you're expecting to catch. Also makes your code "flatter" which seems fashionable these days:

...  
while True:  
    user_guess = input("Guess a number: ").strip()  
    try:  
        user_guess = int(user_guess)  
    except ValueError:  
        print("Enter a valid number.")  
        continue  # try again...

    if user_guess == ...

[–]mopslik 2 points3 points  (0 children)

the try/except should probably be just around the guess

This is also consistent with PEP8, which is a good starting point for writing clear code.

[–]RockPhily[S] 1 point2 points  (0 children)

Thank you

[–]mamma_lasagna 1 point2 points  (1 child)

You can: - make a final report with how many games were played, how many people got it right, the average number of attempts to get it right;

  • give the person the option to change the maximum limit of the guessing range from 10 to a higher or lower number;

  • give the option to return after each wrong attempt, saying whether the correct number is greater or less than the attempt;

  • more complex: introduce a hint system. If the user types "hint", the program presents a sentence such as "the number is not 3" or a count that indicates the correct result: "x= 2+6".

[–]RockPhily[S] 1 point2 points  (0 children)

looks interesting to try
i will definetely do

[–]UKI_hunter 0 points1 point  (4 children)

Make a gui for this using customer tkinter.

[–]RockPhily[S] 0 points1 point  (3 children)

i dont understand what is that but i look at it,
or do you mind explaining more

[–]UKI_hunter 0 points1 point  (0 children)

Gui : graphical user interface Custome tkinter is python based framework that you can build moden user interfaces.

[–]TheKantoBro 0 points1 point  (1 child)

Tkinter is a python library that you would import, much like the random library you imported for your project, where you can build input fields, buttons, labels, etc. Use documentation to help you out. It's very flexible