Generator Expressions
Generator expressions are a high performance and memory efficient generalization of list comprehensions and generators. Imagine we want to sum up all even number ranging from 1 to 100. Using list comprehension: even_sum = sum([x for x in range(1, 100) if x % 2 == 0]) print(even_sum) #2450 This will prove inefficient in the case of a large range because it first creates a list, it iterates over it and then returns the sum....