This Python code generates a random secret number between 1 and 20000000000, then allows the user up to 20 guesses to try and match the number. For each guess, it prints whether the guess is too low, too high, or correct. If the user guesses correctly before 20 tries, it prints congratulations along with the number of guesses. Otherwise, it reveals the secret number.
This Python code generates a random secret number between 1 and 20000000000, then allows the user up to 20 guesses to try and match the number. For each guess, it prints whether the guess is too low, too high, or correct. If the user guesses correctly before 20 tries, it prints congratulations along with the number of guesses. Otherwise, it reveals the secret number.
This Python code generates a random secret number between 1 and 20000000000, then allows the user up to 20 guesses to try and match the number. For each guess, it prints whether the guess is too low, too high, or correct. If the user guesses correctly before 20 tries, it prints congratulations along with the number of guesses. Otherwise, it reveals the secret number.
secretNumber = random.randint(1,20000000000) print("The nummber is betwwen 1 and 200000000.") for guessesTaken in range(1,20): print("Guess!") guess = int(input())
if guess < secretNumber:
print("Too low.") elif guess > secretNumber: print("Too High.") else: break if guess == secretNumber: print("Good Job! You guessed the number in " +str(guessesTaken)+ " guesses!") else: print("Nope. I was thinking of " +str(secretNumber)+ "!")