mercredi 25 janvier 2017

if statements with and or - not working [on hold]

I have this code, but for the line "if c=a and d=b+1:", it says SyntaxError: invalid syntax. What is wrong with it?

a=int(input())
b=int(input())
c=int(input())
d=int(input())


if c=a and d=b+1:
    print("YES")
elif c=a and d=b-1:
    print("YES")
elif d=b and c=a+1:
    print("YES")
elif d=b and c=a-1:
    print("YES")
elif d=b+1 and c=a+1:
    print("YES")
elif d=b+1 and c=a-1:
    print("YES")
elif d=b-1 and c=a-1:
    print("YES")
elif d=b-1 and c=a+1:
    print("YES")
else:
    print("NO")

Aucun commentaire:

Enregistrer un commentaire