See the advice from @Richard-Maccutchan - work your way through The Python Tutorial — Python 3.7.10 documentation
Things to take note of as you go through it:
- How to assign a value to a variable ... then check your code here
'ans1' == ("ok")
'ans2' == ("not ok")
You are not assigning variables there.
- The dangers of cut & paste - these lines here do not attempt to take into account the "not ok" scenario
if a1 == ("ans1"):
if a1 ==("ans1"):
If "ok" then you will print
- Note the difference between a variable and a value -
is a value,
will eventually be a variable (when you fix the problem above). In other words you are checking to see if you have typed in "ans1" not "not ok"
- Which leads nicely to ... understand that "Not OK" and "not ok" are not the same. If you type in "Not OK" as you advise then the program will just terminate as you have not given it anything to do if that is typed in.