if condition:
The if
condition is considered the simplest of the three and makes a decision based on whether the condition is true or not. If the condition is true, it prints out the indented expression. If the condition is false, it skips printing the indented expression.
Example:-
x = 5 if x / 5 == 1: print("True")
OUTPUT:-
if OUTPUT is not TRUE then No Expression Show in display
if-else condition:
The if-else
condition Show one by one Expression in OUTPUT. adds an additional step in the decision-making process compared to the simple if
statement. The beginning of an if-else
statement operates similar to a simple if
statement; however, if the condition is false, instead of printing nothing, the indented expression under else
will be printed.
Example:-
x = 4 if x / 5 == 1: print("True") else: print("False")
OUTPUT:-
if OUTPUT is TRUE then print True Expression Show in display
if-elif-else condition:
The Most Uses and Complex of these condition is if-else-elif statement.When you run into a situation where you have several conditions, you can place as many elif
conditions as necessary between the if
condition and the else
condition.Use the elif
condition is used to include multiple conditional expressions after the if
condition or between the if
and else
conditions.
Example:-
x = 5 if x / 4 == 1: print("True") elif x == 5: print("x is equal to 5") else: print("False")
OUTPUT:-

Now, Make a Program with using if/elif/else statement:-
print("Welcome to the India Army!") height = int(input("what is your height in cm? ")) if height >= 165: print("you can Join Indian army ?") age = int(input("what is your age? ")) if age >= 18 and age <= 25: print("Please pay for Exam fees ₹ 50") elif age >= 26: print("Please pay for Exam fees ₹ 100") else: print("sorry, you have to grow taller before you can Join indian Army! ?")
OUTPUT – 1 (when height is less than requirement)

OUTPUT – 2 (when height is match with requirement and age between 18 to 25)

OUTPUT – 3 (when age greather than 25)

Thank You ! ❤️
Check : How to check and enable ENA on linux and Windows server on AWS