Skip to content

Instantly share code, notes, and snippets.

@johnashu
Created December 28, 2017 11:06
Show Gist options
  • Save johnashu/c15205c3200bc4187ad2809a1341648a to your computer and use it in GitHub Desktop.
Save johnashu/c15205c3200bc4187ad2809a1341648a to your computer and use it in GitHub Desktop.
Yield Generate class created by maffaz - https://repl.it/@maffaz/Yield-Generate-class
arri = [32, 23, 542, 25, 25, 3254, 234]
arri2 = [432, 52, 53, 523, 532, 52]
arri3 = [7, 52, 53, 7, 532, 7]
def n():
print('\n\n')
n = n()
class timesby():
def f(self, arr):
def g(a):
for j in a:
j = j * 2
yield j
for i in g(arr):
yield i
def k(self, arr2):
def j(b):
for m in b:
s = m * 3
yield s
for t in j(arr2):
yield t
def enum1(self, arr3):
print('enum1')
def l(c):
for i, j in enumerate(arr3):
yield i, j
for x, z in l(arr3):
x = 'Hello'
z = z * 3
yield x, z
times1 = timesby()
times2 = timesby()
times3 = timesby()
map1 = list(map(lambda x: str(x) + 'John' if x % 4 else x, times1.k(arri)))
print(map1, n)
map2 = list(map(lambda x: x * 2 if x % 3 else None, times2.f(arri2)))
print(map2, n)
fil = list(filter(lambda x: x * 3 if x == 7 else 1, times3.enum1(arri3)))
print(fil, n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment