im new to python and im doing small projects to gain more knowledge
guess the number
import random
def guess(x):
random_number = random.randint(1, x)
guess = 0
while guess != random_number:
guess = int(input(f'Guess the number between 1 and {x}: '))
if guess < random_number:
print('Sorry, guess again. Too low.')
elif guess > random_number:
print('Sorry, guess again. Too high.')
print(f'Yay congrats. You have guessed the number {random_number} correctly.')
guess(10)
this code doesnt work, it lets me input a number but it just gives me back the number i put in