lundi 8 juin 2020

pyhton if statement with "or" and "!=" condition

arr=input("enter a alphabet ")

if (arr=='a') or (arr=='c'):
    print("it is a or c")
else:
    print("not a or c")

code above gives desired output but code below does not why? please help

arr=input("enter a alphabet ")

if (arr!='a') or (arr!='c'):
    print("not a or c")
else:
    print("it is a or c")

Aucun commentaire:

Enregistrer un commentaire