i need help with a python if-loop i tied
yes=1
play = yes
if play == yes:
import os
import random
import time
n = random.randint(1,10)
g = 0
time.sleep(.25)
print ("guess the number 1-10")
time.sleep(.5)
while g != n:
g = int ( input ( "what is your guess " ))
if g < n:
print ("too low guess again")
if g > n:
print (" too high guess again")
print ("you got the number")
play = input ("play again? ")
time.sleep(.5)
os.system(clear)
can anyone help me
i’m new to python so i’m having trouble with getting it to have it so if you get the number correct then say yes to play again it clears then loops
New contributor
ZACHARY ELLIS is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.