I have an exerceise from the course I study:
Write a program that picks a random integer from 1 to 100, and has players guess the number. The rules are:
If a player's guess is less than 1 or greater than 100, say "OUT OF BOUNDS" On a player's first turn, if their guess is within 10 of the number, return "WARM!" further than 10 away from the number, return "COLD!" On all subsequent turns, if a guess is closer to the number than the previous guess return "WARMER!" farther from the number than the previous guess, return "COLDER!" When the player's guess equals the number, tell them they've guessed correctly and how many guesses it took!
For some reason, even if the guessing number is correct, it will still ask me to enter a new number. Can you please help me to fix it ?
from random import randint
# picks random integer
raffle = randint(1,100)
# entering first guess
guess = int(input("Guess the random number: "))
# checking first guess
if guess < 1 or guess > 100:
print("OUT OF BONDS")
else:
if guess == raffle :
print("Correct! You figured the number after the first try!")
else if guess > raffle:
if guess-raffle < 11:
print("WARM!")
else:
print("COLD!")
else:
if raffle-guess < 11:
print("WARM!")
else:
print("COLD!")
guess_count = 1
match = False
def guess_check():
next_guess = int(input("Guess the random number again: "))
if next_guess < 1 or guess > 100:
print("OUT OF BONDS")
else:
if next_guess == raffle :
print("Correct! You figured the number!")
match = True
elif next_guess > raffle:
if next_guess-raffle < 11:
print("WARMER!")
else:
print("COLDER!")
else:
if raffle-next_guess < 11:
print("WARMER!")
else:
print("COLDER!")
while match != True:
guess_check()
print(f"The random number is: {raffle}")
```python