lundi 11 février 2019

Python Operators and If Condition

answer = str(raw_input("Is the information correct? Enter Y for yes or N for no")) if answer == "y" or answer == "Y": print("this will do the calculation") else: exit()

Is this way the correct to use condition with OR operator? Or Can I also write like this:

if answer == "y" or "Y":

Aucun commentaire:

Enregistrer un commentaire