inとnotの使いどころ
in
y = [1, 2, 3]
x = 1
if x in y:
print('in')
in
not
y = [1, 2, 3]
x = 1
if 100 not in y:
print('not in')
not in
a = 1
b = 2
if a != b:
print('Not equal')
Not equal
notの使いどころ
boolean型
is_ok = True
#if is_ok == True:
if is_ok:
print('hello')
hello
is_ok = True
if not is_ok:
print('hello')
コメント