Video 5: Conditionals (page 3 of 10) |
The simplest conditional is the if statement. The Boolean expression after the if statement is called the condition. Python supports the standard logical conditions.
1. Equals: x == y
2. Not Equals: x != y
3. Less than: x < y
4. Less than or equal to: x <= y
5. Greater than: x > y
6. Greater than or equal to: x >= y
Recall that we use a single "=" for assignment (i.e., x = 6) but the double "==" for comparison (i.e., x==6 would test if the value of x is equal to 6).