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 🤘

SDE II at Amazon. ✍️ Blog Writer 🔸 👨‍💻 Full Stack Engineer