while True:
import random
print("-------Guess my number-------")
print("You need to guess the number picked by enigmatic computer!")
print("Number is in range from 1 to 10")
magic_number = random.randint(1, 10)
count = 0
user_number = 0
while user_number != magic_number:
user_number = int(input("Your number: "))
count+=1
if magic_number > user_number:
print("The magic number is greater than yours!")
elif magic_number < user_number:
print("The magic number is less than yours!")
print("You Win! You guessed it on the", count,
"try")
while True:
print ("Want to play again?")
answer = str(input())
if answer == ("no"):
print ("Okay, see you later")
break
if answer == ("yes"):
import random
print("-------Guess my number-------")
print("You need to guess the number picked by enigmatic computer!")
print("Number is in range from 1 to 10")
magic_number = random.randint(1, 10)
count = 0
user_number = 0
while user_number != magic_number:
user_number = int(input("Your number: "))
count+=1
if magic_number > user_number:
print("The magic number is greater than yours!")
elif magic_number < user_number:
print("The magic number is less than yours!")
print("You Win! You guessed it on the", count,
"try")
нужно чтобы цикл продолжался только при ответе "yes"