2015년 1월 10일 토요일

python 제어 연산자

if 1 == 1:
    print("True : %s" % "1==1")

if 1 is 1:
    print("True : %s" % "1 is 1")

if 1 != 2:
    print("True : %s" % "1 != 2")

if 1 is not 2:
    print("True : %s" % "1 is not 2")

if 1 is not 2 and 1 is 1:
    print("True : %s" % "1 is not 2 and 1 is 1")

if 1 is not 2 or 1 is 1:
    print("True : %s" % "1 is not 2 or 1 is 1")

if not(1 is not 2 or 1 is 1):
    print("not here : %s" % "not(1 is not 2 or 1 is 1)")
else:
    print("here : %s" % "not(1 is not 2 or 1 is 1)")

True : 1==1
True : 1 is 1
True : 1 != 2
True : 1 is not 2
True : 1 is not 2 and 1 is 1
True : 1 is not 2 or 1 is 1
here : not(1 is not 2 or 1 is 1)

댓글 없음: