

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
Not enough gems
Cost: 6 gems
1: Python Numbers
incomplete
2: Numbers Review
incomplete
3: Floor Division
incomplete
4: Exponents
incomplete
5: Changing in Place
incomplete
6: Plus Equals
incomplete
7: Scientific Notation
incomplete
8: Logical Operators
incomplete
9: Not
incomplete
10: Binary Numbers
incomplete
11: Bitwise '&' Operator
incomplete
12: Bitwise '|' Operator
incomplete
13: Damage Meter
incomplete
14: Converting Binary
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
You're probably familiar with the logical operators and and or.
Logical operators deal with boolean values, True and False.
The logical and operator requires that both inputs are True to return True. The logical or operator only requires that at least one input is True to return True.
For example:
True and True == True
True and False == False
False and False == False
True or True == True
True or False == True
False or False == False
print(True and True)
# prints True
print(True or False)
# prints True
We can nest logical expressions using parentheses.
print((True or False) and False)
First, we evaluate the expression in the parentheses, (True or False). It evaluates to True:
print(True and False)
True and False evaluates to False:
print(False)
So, print((True or False) and False) prints "False" to the console.