Q:

Python 2 - How to make the script go to a specific line?

This is kind of an extension to my last question, but I was wondering if it is possible to make the script go back to a specific line, if an event happens.
print "Type in 'Hello'"
typed = raw_input("> ")
if typed.lower() in ['hello', 'hi']:
    print "Working"
else:
    print "not working" 

On the last line, if 'else' happens, can you make it so it restarts from line 2 again? 
Any help will be very greatly appreciated, thanks a lot!

A:

You could put your code in an endless loop that only exits if the right word is typed in:
print "Type in 'Hello'"
while True:
    typed = raw_input("> ")
    if typed.lower() in ['hello', 'hi']:
        print "Working"
        break
    else:
        print "not working" 

A:

You can let the program lie in a loop till the correct input is given
while True: 
    print "Type in 'Hello'"
    typed = raw_input("> ")
    if typed.lower() in ['hello', 'hi']:
        break

