2.4.1 Decision Making
Python Programming
Decision making in programming allows the program to choose different actions based on conditions. This is similar to how we make decisions in real life. Python provide variety of conditional statements to implement decision making. Below find the detailed implementation of python conditional statements.
2.4.1.1 if Statement
The if statement lets us make decisions based on conditions. If the condition is true, it runs a block of code.
python
# Syntax of if statement if condition:
if condition:
# code to run if the condition is trueExample: If the temperature is above 30 degrees, we print a message.
python
temperature = 35
if temperature > 30: