paint-brush
11 Tips And Tricks To Write Better Python Codeby@pragativerma
2,097 reads
2,097 reads

11 Tips And Tricks To Write Better Python Code

by Pragati Verma8mAugust 16th, 2022
Read on Terminal Reader
Read this story w/o Javascript

Too Long; Didn't Read

Python generally use a `for` loop to iterate over an iterable object. But there is an easier and more pythonic way to do this by using `enumerate() instead of a 'for' loop. List comprehension instead of raw for loops is a way to create lists based on the existing lists. It can be used to sort the elements in a sorted list or sequence (tuple, set, frozen set) or collection (frozen set) The syntax of a list comprehension looks like this: 'HackerNoon'

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - 11 Tips And Tricks To Write Better Python Code
Pragati Verma HackerNoon profile picture
Pragati Verma

Pragati Verma

@pragativerma

I am a Software Developer with a keen interest in tech content writing.

Learn More
LEARN MORE ABOUT @PRAGATIVERMA'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Pragati Verma HackerNoon profile picture
Pragati Verma@pragativerma
I am a Software Developer with a keen interest in tech content writing.

TOPICS

Languages

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Joyk
Nommu
Coffee-web
Technoblender