In programming, generators are essentially functions that returns an array (it takes in parameters, can be called, and generates a sequence of values) but yields the values one at a time (i.e., it behaves like an iterator). This requires much less memory to execute.
Comprehensions
Generator comprehension uses similar syntax as list comprehension, just without square brackets. Below is the same functionality as above: