How to Use Elif Keyword in Python


In this example, we will learn how to use the elif keyword in Python.

Source Code

x = 20
y = 20
if x > y:
    print('x is greater than y')
elif x == y:
    print('x and y are equal')

Output:

x and y are equal
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Advertisement