Published in


The Art of Writing Loops in Python

Simple is better than complex

Photo by Jie on Unsplash

The for loop is a very basic control flow tool of most programming languages. For example, a simple for loop in C looks like the following:

int i;
for (i=0;i<N;i++)
//do something

There are no other ways to write a for loop more elegantly in C. For a complex scenario, we usually need to write ugly…




Technology gives us more and more freedom. Start learning today.

Recommended from Medium

The Journey to Traefik Enterprise Edition: HTTPS for Everyone

Migration to AWS Native Databases

Simplifying complex queries with the ActiveRecord Union gem

Setup PHP Script from CodeCanyon.

Setup PHP Script from CodeCanyon.

How To Add Summernote Editor In Laravel 8

How to find k-th smallest/largest element in an unsorted array?

MicroProfile, a knight, or just another pawn?

CSS backdrop-filter Examples

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
Yang Zhou

Yang Zhou

I’m a full-stack engineer who also writes.

More from Medium

Beating Wordle with Python

Building a Wordle Bot In Under 100 Lines of Python

Wordle bot python

Build a Wordle Solver Using Python 3

A Quick Trick to Make DataFrames with Uneven Array Lengths