If statement in Python

Updated: May 18


If statements are control flow statements and it is run a particular code only when a condition is satisfied. It means that to print a message or result on the screen only when a condition is true and it condition is false then it is not print a message or result on screen. if..else, if..elif..else are other control flow statements available in Python.


Syntax:

if condition:

statement


Example:

a = True

if a==True:

print("Welcome")

print("To")

print("Career Bodh Sansthan")


Output:

Welcome

To

Career Bodh Sansthan



Recent Posts

See All

Python Modules

A module is a file containing Python definitions and statements. A module can characterize functions, classes and variables. A module can likewise incorporate runnable code. Gathering related code int

Command Line Arguments in Python

Command Line Arguments are the arguments that are specified after the name of the program in the command line shell of the operating system. Python gives different ways of dealing with these types of