Last active
June 25, 2021 06:12
-
-
Save velotiotech/a81b3d829a82d2dcf43ed6e70b7e8c8b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def g1(s={}): | |
f1 = lambda a: a.strip().split() | |
f2 = lambda a: map(lambda x: s[x] if x in s else s.setdefault(x, len(s) + 1), a) | |
f3 = lambda a: "->".join(map(lambda b: str(b), a)) | |
return f1, f2, f3 | |
def g2(x, fs): | |
for f in fs: | |
x = f(x) | |
return x | |
fs = g1() | |
print(g2("Hello World", fs)) | |
print(g2("Hello Sam", fs)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment