Skip to main content

Python if Statement

If statements are control flow statements which helps us to run a particular code only when a certain condition is satisfied. if statement is the most simple decision making statement. It is used to decide whether a certain statement or block of statements will be executed or not.

An if statement allows you to write a block of code that gets executed only if the expression after if is true.

Syntax:

if (condition):
    (statement)

Example:

if (2<3):
    print("Hello")

Output:

Hello

Tags
Submitted by devanshi.srivastava on June 3, 2021

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.

About

At ProgramsBuzz, you can learn, share and grow with millions of techie around the world from different domain like Data Science, Software Development, QA and Digital Marketing. You can ask doubt and get the answer for your queries from our experts.