If you want to keep running the same piece of code many times in some specific condition, we could be provide loops method.
Loops must have the loop condition that may be true or false.
These of code is called loop body for a loop.
answer = "no" ----> first declared the variable answer for store a string
while answer == "no": ---> the loop condition
answer = input("Are we there? ") --> The loop body
print("We're there!") --> final out put
print ("Welcome!")
guess = 0
while guess != 5:
g = input("Guess the number: ")
guess = int(g)
if guess == 5:
print("You win!")
else:
if guess > 5:
print("Too high")
else:
print("Too low")
print("Game over!")
Source form : Orelly Head First Programming