笔记1_python中的逻辑运算符and、or、not
and:表示与。若x为false,x and y返回false;x为true,x and y返回y的值;
or:表示或。若x为true,x or y 返回x的值;若x为false,x or y 返回y的值;
not:表示非。若x为true,not x返回false;若x为false, not x返回true。
例:
x = 1, y = 2。
x and y: 2
x or y: 1
not x: False
笔记1_python中的逻辑运算符and、or、not
and:表示与。若x为false,x and y返回false;x为true,x and y返回y的值;
or:表示或。若x为true,x or y 返回x的值;若x为false,x or y 返回y的值;
not:表示非。若x为true,not x返回false;若x为false, not x返回true。
例:
x = 1, y = 2。
x and y: 2
x or y: 1
not x: False