Generator-Expressions
Sat 17 May 2025
title: "Generator Expressions Simple" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false
abc = [6, 8, 23, 2, 19]
abc
[6, 8, 23, 2, 19]
result = [x for x in abc if(x > 6)]
result
[8, 23, 19]
square = [x*x for x in result]
square
[64, 529, 361]
# More expressions can be found here: https://www.python.org/dev/peps/pep-0289/
Score: 5
Category: basics