How do i add different levels & quit option to my guess a number game? : So i'm a freshman in high school trying to figure out python coding, and I need to make a guess a number game. 

My first level works fine, but I need to make it so it has 3 different levels, and a quit option, I don't understand these while loops. 

I'm really sorry if I posted something wrong or this is an already asked question, but any help would be much appreciated! 

 

       import random
    print("let's play guess a number!")
    myLevel=int(input("would you like to play level 1, 2, 3, or quit?"))
    
    if myLevel == 1:
        number1= random.randit(1,10)
        guess1=int(input("guess an integer from 1 to ten"))
        
    while number1!=guess1:
        print
        if guess1<number1:
                     print("guess is too low")
                     guess1=int(input("guess again! or would you like to quit?"))
                     #this is where i want to be able to quit
        elif guess1>number1:
                     print("guess is too high!")
                     guess1=int(input("guess again! or would you like to quit?"))
                     #this is where i want to be able to quit
        if guess1==number1:
                    print("you guessed it!")
    
    if myLevel == 2:
    nextumber2= random.randint (1,100)
    guess2=int(input("guess an integer from 1 to 100"))
    
    while number2!=guess2:
    print
    
    if guess2<number2:
            print("guess is too low!")
            guess2=int(input("guess again!"))
    elif guess2>number2:
            print("guess is too high!")
            guess2=int(input("guess again!"))
    
    print("you guessed it!")





