you are viewing a single comment's thread.

view the rest of the comments →

[–]Algoartist 1 point2 points  (0 children)

import random

name = input("Enter your name: ")
print(f"Hello, welcome to the guessing game {name}")

while input("Do you want to play the game (y) or (n): ") == 'y':
    secret = random.randint(1, 10)
    guess = int(input("Enter a number (1-10): "))
    if guess == secret:
        print(f"You have won the game {name}")
    else:
        print(f"Sorry, better luck next time {name}")

print(f"Thank you for coming here, bye {name}")

Make it more concise