Generator Pipeline
Build a 3-stage generator pipeline: one generator yields the given numbers, one squares them, and one filters to keep only values greater than 20.
Approach: chain three generator functions (readnumbers, squareall, filtergreaterthan_20), feeding each one's output into the next, and materialize the final result with list().
Input: One line: space-separated integers.
Output: One line: the squared, filtered values as a Python list.
1 2 3 4 5 6
[25, 36]
- 1 <= number of values <= 100
Hint 1
Each generator stage takes the PREVIOUS generator as its input, not the original list.
Hint 2
filter_greater_than_20 should yield n only when n > 20.
Hint 3
Nothing is actually computed until list(pipeline) pulls every value through all three stages.
readnumbers simply yields each input number in turn; squareall yields the square of whatever it receives; filtergreaterthan_20 yields only the squares greater than 20. Because each stage is a generator consuming the previous one, nothing is computed eagerly — list(pipeline) is what actually pulls every value through all three stages, one at a time.