python function with if else code example

Example 1: else if python

if expression1:
   statement(s)
elif expression2:
   statement(s)
elif expression3:
   statement(s)
else:
   statement(s)

Example 2: else if python

if (condion):
   result
    
elif (condition):
   results
    
else:
   result

Example 3: if else python

# IF ELSE ELIF
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")

Tags:

Cpp Example