Mar-09-2020, 11:39 AM
i am very new to python and began a few days ago, and decided to build a guessing game. i have completed the game but need help in the end part. here is my code
import random
print ("Hello! Lets begin the Guessing Game!")
n = random.randint(1, 100)
print("Start by guessing the number I chose. It is between 1 and 100.")
guess = int(input())
while guess != n or guess == n:
if guess < n:
print('Higher')
guess = int(input())
elif guess > n:
print ('Lower')
guess = int(input())
if guess == n:
print ("Congrats! you got it!")
print ('Do you want to try again')
ans=(input(Y/N))
if ans== N:
raise SystemExit
else ????the question mark is where i am stuck. i want code that can send the user back up to the start and restart the game if they say yes. But due to an absence of goto I don't know how to do this. Thanks in advance

)