The problem is to ask the user to guess a number between 1 to 100 and compare it with a random number of that range. If user guessed number is lesser/greater than the random number print "too low" or "too high" accordingly. Take new input asking the user to guess the correct number again. When the guessed number matches with the random number print "you win" and the number of attempts the user required to guess it.
import random
u_num = int(input("guess a number between 1 to 100: "))
w_num = random.randint(1,100)
i = 1
while u_num != w_num:
if u_num < w_num:
print("too low")
else:
print("too high")
u_num = int(input("guess again: "))
i += 1
print(f"you win, and you guessed this number in {i} times!")