Discuss / Python / python的逻辑与,不是& 么?

python的逻辑与,不是& 么?

Topic source

sunshine_cxc

#1 Created at ... [Delete] [Delete and Lock User]

写了个条件 bmi>18.5 & bmi<25,报错.

sunshine_cxc

#2 Created at ... [Delete] [Delete and Lock User]

发现了,是忘了加括号了.应该是( bmi>18.5) &( bmi<25)

廖雪峰

#3 Created at ... [Delete] [Delete and Lock User]

bmi>18.5 and bmi<25


  • 1

Reply