DEV Community

Cover image for Overview of conditions in python.
Keshav Jindal
Keshav Jindal

Posted on

5 3

Overview of conditions in python.

1.Introduction
Conditions in python helps us in many ways as they are the block of code in which we can specify some condition in the code to be performed.
2.If
The if statement shows a code for a decision making statement. 'if' is the keyword and ended by ':' at the end.
syntax
Image description
The output for above example is
Image description
3.Elif
The elif condition means that if the previous condition is not satisfied then elif statement will be checked. The 'elif' is the keyword and ended by colon.
syntax
Image description

The output for above example is
Image description
4.Else
The else statement means that if the 'if' or 'elif' statement is not true then this will be correct.
Image description
The output for above example is
Image description

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Top comments (3)

Collapse
 
riju_bro profile image
riju_bro • Edited

Good for beginners.

Collapse
 
andrewbaisden profile image
Andrew Baisden

Good intro for a Python beginner.

Collapse
 
nilesh_jindal_85ed2091da1 profile image
Nilesh Jindal

Good work.

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay