10 Coolest Python Features — Part I

Hidden Python features that you may not know

Photo by Chris Ried on Unsplash

1. For Else

Using a flag variable
Using for-else

2. Yield

Method 1

Method 2

Using yield keyword

3. Pprint

Using print
Using pprint
print and pprint code

4. Comparison Chaining

Comparison Chaining

5. Timeit

timeit

Thank you 🤘

Software Engineer @ Optum. ✍️ Blog Writer 🔸 👨‍💻 Full Stack Developer

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