>>> 'a' in 'aeiou' or 'steve' True >>> 'S' in 'Sam' and 'Steve' 'Steve' >>> 'a' in 'aeiou' and 'steve' 'steve' >>> 's' in 'aeiou' or 'AEIOU' 'AEIOU'
我正在为一些学生上课,并对最后三个输出感到惊讶.我期待一个布尔值.任何人都可以对此有所了解吗?
python operators boolean-expression
为什么我应该使用elif而不是一遍又一遍地使用if语句。我找不到有关此事的任何文档。先感谢您。
python
python ×2
boolean-expression ×1
operators ×1