Chrome Extension

If else conditions python

x = 50
y = 30
if x > y:
    print("x is greater than y")
elif x == y:
    print("x equals to y")
else:
    print("y is greater than x")
We are a bunch of lazy programmers so we developed this chrome extension
search code from your favorite search engine
Install Now
Output
x is greater than y

The code snippet shows the nested if-else example. we use 'elif' keyword in place of else if which is used in most of the programming languages. In the code snippet, we have compared values of x and y variables.

If the value of x is greater than y - it will print 'x is greater than y'

If the value of y is greater than y - it will print 'y is greater than x'

If the value of x equals to y - it will print 'x equals to y'

Was this helpful?
0 Comments
Open Code Manager We are hiring