In this lesson, you'll learn how to use conditions (if statements) to control the flow of your program based on different scenarios.
A condition allows the program to decide what action to take based on whether something is true or false. Let’s see an example:
Example in Python:
age = 18
if age >= 18:
print("You are an adult")
else:
print("You are a minor")
Try writing a condition in your Python environment. You can use the code above and change the age to see how the result changes!
What is the correct way to write an if condition in Python?
© 2025 Ocean Explorer | All Rights Reserved