The Startup
Published in

The Startup

Use of else block with Python loops

An awesome feature that most programming languages do not offer

“An else block can exist only when an if block exists before it.”

As a programmer not belonging to Python background, I was a strict follower of this rule. But I was left awestruck and confused after I saw one of my friends’ Python code that used an else block after a for loop. So, I performed some research and found that Python provides a feature, that allows us to use an else block with for and while loops. The else block after a for or…




Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +756K followers.

Recommended from Medium

QOI: Quite Ok Image format

CXL Scholarship — 7th Week Review

Make your own Python package!

FSN — Taking on Python

How to create a scrollable list in Flutter

GT-Scan2: Bringing Bioinformatics to Alibaba Cloud

DeepMind in 4: Week 5 Summary, Week 6 Goals

Getting started with JAM-stack: Amplify, Gatsby and Contentful

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sagun Raj Lage

Sagun Raj Lage

Author of Getting Started with WidgetKit (2021) | iOS Engineer | Full Stack Engineer

More from Medium

Analyze Data From NY Taxies, ML Tell Us Where Is The Best Place To Take A Taxi!

Undruggable targets: the major challenge for modern drug discovery

Nominations are open to serve on the DISC committee!

My project idea for SubQuery grants program: Solution for autonomous generation and implementation…