Python Program to execute if statement without any expression


In this program, You will learn how to execute if statement without any expression in Python.


if x > 0: Welcome else: Thank You!

Example: How to execute if statement without any expression in Python.

x = int(input("Enter a number:"))

if x:
    print("Welcome")
else:
    print("Thank You!")

Output

Enter a number:0
Thank You!