Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created Jul 21, 2020
Embed
What would you like to do?
g=(n for n in range(1,11) if n%2==0)
print (g) #Output: <generator object <genexpr> at 0x0116C728>
#We can loop through generator object.
for i in g:
print (i, end=" ") #Output: 2 4 6 8 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment