Hi I am a new student in computer science and I am unable to get my while loop to break off and it just keeps going, any suggestions would be appreciated. Below is the aforementioned program -
import random
import time
correct = False
while correct == False:
actual_number = random.randint(1, 10)
print("I am thinking of a number between 1 and 10")
guess = input("What is the number? ")
Real_answer = "The answer was " + str(actual_number)
Real_guess = "you guessed " + str(guess)
print(Real_answer)
time.sleep(0.7)
print(Real_guess)
time.sleep(0.7)
if guess == actual_number:
correct == True
print("Congratulations! You guessed correctly")
sys.exit()```
Aucun commentaire:
Enregistrer un commentaire