Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: How does python executes multiple boolean in one statement?

With following condition, what should Python return? In which sequence the condition will get executed?

True or False and False and True

like image 219
Vivek Avatar asked May 18 '26 17:05

Vivek


1 Answers

AND has a higher precedence than OR.

True or False and False and True -> True or TRUE and True -> True or TRUE -> TRUE.

http://www.mathcs.emory.edu/~valerie/courses/fall10/155/resources/op_precedence.html

like image 99
Dean Dumitru Avatar answered May 20 '26 06:05

Dean Dumitru



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!