Breaking News

Python elif and else statement.

                                                       elif and else statement

Elif

The elif watchword is pythons method of saying if the off chance that the past conditions were false, at that point attempt this condition.
a = 5
b = 5

if b > a:

  print("b is greater than a")


elif a == b:

  print("a and b are equal")
output;

a and b are equal
Else

The "else condition" is typically utilized when you need to pass judgment on one articulation based on other. On the off chance that one condition turns out badly, at that point there ought to be another condition that ought to legitimize the announcement or rationale.
a = 65
b = 60
if b > a:
print("b is greater than a")
elif a == b:
  print("a and b are equal")
else:
  print("a is greater than b")
output;

a is greater than b



No comments