get even iterable example

This commit is contained in:
Mert Gör ☭ 2023-09-06 19:01:59 +03:00
parent b7f1d07142
commit a621f44d78
No known key found for this signature in database
GPG Key ID: 2100A876D55B39B9
1 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,10 @@
def geteven(iterable):
for x in iterable:
if x % 2 == 0:
yield x
l = [2, 5, 7, 8, 4]
for i in geteven(l):
print(i, end=' ')
print()