jeudi 7 janvier 2021

How do I set a print condition in python 3.9? [duplicate]

I'm new to python and was wondering how i can get my code to do the following:

  • take user input 1
  • take user input 2
  • if user input 2 doesn't equal string "exampleString", print "Incorrect input"
  • in which case prompt input 2 again
  • otherwise carry on to input 3

So far I have the following:

a=input(Provide input 1)
b=input(Provide input 2)
if b != "exampleString"
    print "Incorrect input"
c=input(Provide input 3)

Would appreciate some help on adding this logic in. I'm also wondering how i can set the condition to move onto input 3 if input 2 is correct. Thank you in advance

Aucun commentaire:

Enregistrer un commentaire