--Originally published at Carolina's Blog Site
- You can use if statements to run code if a certain condition holds.
- An if statement looks like this: if expression: statements.
- Boolean logic is used to make cooler if statements that have 2+ conditions. Python’s Boolean operators are and, or, and not.
- And: Takes 2 arguments. It evaluates to True if both are True.
- Or: Takes 2 arguments. It evaluates to True if either or both are True.
- Not: Takes 1 argument, and inverts it. The result of not True is False, and not False goes to True.
>> not 1 == 1
False
>> not 1 > 7
True
Anyway, Operator precedence is a very important. Python’s order of operations is the same as that of normal math: Please Excuse My Dear Aunt Sally.
I got this chart from: http://www.sololearn.com/Play/Python