** * This article is from Udemy "[Introduction to Python3 taught by active Silicon Valley engineers + application + American Silicon Valley style code style](https://www.udemy.com/course/python-beginner/" Introduction to Python3 taught by active Silicon Valley engineers + application + American Silicon Valley style code style ")" It is a class notebook for myself after taking the course of. It is open to the public with permission from the instructor Jun Sakai. ** **
in_and_not
y = [1, 2, 3]
x = 1
if x in y:
print('in')
if 100 not in y:
print('not in')
result
in
not in
not
a = 1
b = 2
#Than doing this
if not a == b:
print('Not equal')
#Should do this
if a != b:
print('Not equal')
result
Not equal
Not equal
boolean_not
is_ok = True
if not is_ok:
print('hello')
result
It may be a little unpleasant if you don't get used to it, Familiarize yourself with the boolean type, which is often described with not.
Recommended Posts