10 月 092020
 
#布尔运算符and,or用于布尔值之间的运算
#not x:如果x是True则返回False,否则返回True
#x and y:如果x和y都是True则返回True,有一个是False则返回False
#x or y:如果x和y有一个是True则返回True,如果x和y都是False则返回False
print(1 < 3 and 2 < 5) #True
print(1 < 3 and 2 > 5) #False
print(1 < 3 or 2 > 5) #True
print(1 > 3 or 2 > 5) #False
PS C:\Users\harveymei> & C:/Users/harveymei/AppData/Local/Programs/Python/Python39/python.exe c:/Users/harveymei/hello.py
True
False
True
False
PS C:\Users\harveymei>

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)