← Python Roadmap Home

12. Mini Project

Number guess game

Ab chhota project: computer 1–10 number sochta hai, user guess kare.

import random
secret = random.randint(1, 10)
guess = int(input("Guess (1-10): "))
if guess == secret:
    print("Correct!")
else:
    print("Nope, it was", secret)

Isko expand karo: 3 chances, score, ya high-low hints.