[Python] Working on a python problem trying to guess a randomly generated number im generally...

Discussão em 'Python' iniciado por Stack, Julho 16, 2025.

  1. Stack

    Stack Membro Participativo

    having trouble when it trys comparing the input and the random integer

    import random
    target = random.randint(1,100)
    counter = 0
    print(target)
    print(int(input('Guess an integer between 1 and 100 ')))
    guess = input
    while guess != target():
    if guess > target():
    print("Guess is to high")
    elif guess < target():
    print("Guess was to low")
    counter = counter + 1
    print(int(input('Guess an integer between 1 and 100 ')))

    print("Correct it took you " + str(counter) + " guesses to get the correct number")



    i tried changing the variable names starting from scratch several times googled tons of stuff but im lost and and confused and need an answer so please if you understand my problem id appreciate some advice

    Continue reading...

Compartilhe esta Página