my else statement is not running and if i give a higher value then the set value of 5 it does not say i have to go lower

Viewed 13
guess = int(input("What is your guess?: "))
correct_number = 5
guess_count = 1

while guess != correct_number:
  guess_count +=1
  if guess_count < correct_number:
    guess = int(input("Wrong. YOu need to guess higher. What is your guess?: "))
  else:
    guess = int(input("Wrong. You need to guess lower. What is your guess?: "))


print(f"Congrats! the right answer was {correct_number}. It took you {guess_count} guesses.")

my else statement is not running and giving the correct answer.

0 Answers
Related