Skip to content
C

Even Number Generator

Easypython

Write a generator function even_numbers(limit) that yields every even number from 2 up to limit, then print all the values it produces.

What the problem means: instead of building a full list of even numbers up front, yield each one lazily — this is the core generator pattern from this topic.

Approach: use yield inside a loop from 2 to limit (inclusive), stepping by 2, then join the generated values into one comma-separated line.

Input: One line: limit, a whole number.

Output: One line: the even numbers from 2 up to limit, comma-and-space separated.

Input (stdin)

Output

Run your code to see output here...