import random
def play_game():
target_number = random.randint(1, 100)
attempts = 0
print("Welcome to the Number Guessing Game!")
print("I'm thinking of a number between 1 and 100.")
while True:
guess = int(input("Take a guess: "))
attempts += 1
if guess < target_number:
print("Too low! Try a higher number.")
elif guess > target_number:
print("Too high! Try a lower number.")
else:
print(f"Congratulations! You guessed the number in {attempts} attempts.")
break
play_game()
Post Top Ad
Your Ad Spot
Post Top Ad
Your Ad Spot
Author Details
??? ??? ??? ?????? ?? ??? ????? ????? ??? ??????? ????? ?????? ????? ?????ً،??? ???? ???? ?????? ?? ???? ??? ?????? ???? ????? ?? ?? ???? ?? ????? ?? ???????? ???? ????? ??? ??????? ????? ???? ?? ????، ??? ???? ???? ?? ??? ?????? ??? ?? ????? ??? ????? ??? ???? ????? ?? ?????، ??? ????، ??? ????، ?? ??? ??? ?????. ???? ????? ???ً ?????ً ??????ً.
No comments:
Post a Comment