How to ask a string again if the wrong answer is entered?
<p>I'm trying to get a string to keep repeating if the answer is wrong. How would I go about doing this? The code I have is below which works but doesn't repeat the answer.</p>

<pre><code>print("Hello there, what is your name?")
MyName = input()
print ("Nice to meet you " + MyName)
print ("What is 2 + 2?")

answer = input()
if answer is '4':
    print("Great job!")
elif answer != '4':
    print ("Nope! please try again.")
while answer != '4':
    print ("What is 2 + 2?")
    break
</code></pre>

<p>Here is my two cents for python2 : </p>

<pre><code>#!/usr/bin/env python


MyName = raw_input("Hello there, what is your name ? ")
print("Nice to meet you " + MyName)

answer = raw_input('What is 2 + 2 ? ')

while answer != '4':
    print("Nope ! Please try again")
    answer = raw_input('What is 2 + 2 ? ')

print("Great job !")
</code></pre>

python