How to Use Else Keyword in Python


In this example we will show how to use the else keyword in Python.

Source Code

x = 20
y = 8
if x > y:
    print('x is greater than y')
else:
    print('x is not greater than y')

Output:

x is greater than y
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments