how to do if else in python code example
Example 1: if statement in python
a = 123
b = 123
if(a==b):
print('True')
a = 2
b = 45
if(a<b):
print('A is smaller than B')
Example 2: else if python
if (condion):
result
elif (condition):
results
else:
result
Example 3: if else python
age=int(input("Enter your age:"))
if age<=18:
print("sorry your are not eligible for vote")
elif age>=18:
print("u are eligible for vote")
else:
print("in some how the previou's condition fails else part will run")
Example 4: if else usage python
if expression:
statement(s)
else:
statement(s)