Lesson 4
Repeated Practice Makes Perfect
Chapter 2: Logical operators
Logical operations in conditions
Now, imagine you are given the code below. Try to understand what it does.
x = 8
y = 3
z = 5
if x < 2:
print("Good x")
if x > 7:
print("Good x")
if 2 <= x <= 7:
print("Bad x")
if y > 3:
if z > 4:
print("Good yz")
else:
print("Bad yz")
else:
print("Bad yz")
❮
❯