Jan-01-2020, 07:33 AM
correct_number = "69" hint_a_min = "0" hint_a_max = "50" hint_b_min = "70" hint_b_max = "99" guess = input("Guess a number between 1 and 100: ") guess_count = 0 guess_max = 10 out_of_guesses = False while guess != correct_number and not(out_of_guesses): if (hint_a_min <= guess <= hint_a_max) and (guess_count < guess_max): guess = input("Too cold! Try again: ") guess_count += 1 elif (hint_b_min <= guess <= hint_b_max) and (guess_count < guess_max): guess = input("Too hot! Try again: ") guess_count += 1 elif (hint_a_max < guess < hint_b_min) and (guess_count < guess_max): guess = input("So close! Try again: ") guess_count += 1 else: out_of_guesses = True if out_of_guesses: print("You lost! Try again next time!") else: print("Congratulations!")# error unsolved: the program still recognizes 3 digit number as a value in between 1 and 100
# it must be easy but i can't seem to find the error
# if there is a simpler way to code this exact game, i want to know too!
# Thank you in advance!