import random def gamble(): counter = 0 print("in this game you have to guess a random number between 1 and 100") target = int(random.randint(1,100)) while True: guess = int(input("Take a guess! : ")) if target == guess: print("You won!") print("guesses taken: ",counter) break if target > guess: print("too low") if target < guess: print("too high") counter = counter+1 gamble()