How to Run a Condition in an If Statement in Python


In this example, we will learn how to run a condition in an if statement and get the Boolean answer in Python.

Source Code

x = 10
y = 20

if x > y:
    print("x is greater than y.")
else:
    print("x is not greater than y.")

Output:

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