Every now and then we come across List and Dict operations in our code. Python gives great syntactical sugar to work with List and Dicts.

Photo by Clément H on Unsplash

Whether it is initializing a new list or transforming an existing list, list comprehension is often very handy.

Consider the following code:

output = [expression for item in collection]
or
output = [doSomething() for var

Abinash Panda

ML Engineer | Full Stack Developer | Technology Enthusiast | Sports Lover

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