Tips For Python

The one with the generators!

Hey! welcome back! I wanted to bring to show something very cool. Its called a generator. Basically a generator functions allow you to declare a function that behaves like an iterator, i.e. it can be used in a for loop.

I have introduced you to generators before in the article about yield functions. Today we will look another way to improve our code by using…