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>

<pre><code>print('Guess 2 + 2: ')
answer = int(input())
while answer != 4:
    print('try again')
    answer = int(input())
print('congrats!')
</code></pre>

<p>I think this is the simplest solution. </p>

python