How to print info when 2 things are correct and to use the input fuction when the those two things are incorrect
<p>I am doing a controlled assessment. I have this code : </p>

<pre><code># user Qualifications
print("\nQualification Level")

print("\n""\"AP\" = Apprentice",
      "\n\"FQ\" = Fully-Qualified")
user_qual = input("Enter you Qualification Level: ")
</code></pre>

<p>When the <code>user_qual</code> is equal to <code>AP</code> or <code>FQ</code> I want to print "correct". But when the <code>user_qual</code> is not equal to either <code>AP</code> or <code>FQ</code>, I want to print an error message and re-ask the <code>user_qual</code> input question. However, I tried many different ways but couldn't do it.</p>

<p>Please just give a simple solution and nothing complicated. I am just a beginner and learning the basics.</p>

<p>You can try defining the qualification levels within a variable. In this simple case a <a href="http://openbookproject.net/thinkcs/python/english3e/tuples.html" rel="nofollow">tuple</a> suffices, but if there were to be more qualification levels, a <a href="http://openbookproject.net/thinkcs/python/english3e/dictionaries.html" rel="nofollow">dictionary</a> would make more sense.</p>

<pre><code>qualification_levels = ('AP', 'FQ')
print("\n""\"AP\" = Apprentice",
      "\n\"FQ\" = Fully-Qualified")
user_qual = input("Enter you Qualification Level: ")
if user_qual in qualification_levels:
    print('correct!')
else:
    print('ERROR!!!')
</code></pre>

python python-3.x