Created
July 27, 2014 11:28
-
-
Save Leonidas-from-XIV/715cc67d159ce4983086 to your computer and use it in GitHub Desktop.
Simple Python solution for g()('al') challenge
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| class G(object): | |
| def __init__(self, prefix='g'): | |
| self.prefix = prefix | |
| def __call__(self, args=None): | |
| if args == 'al': | |
| return self.prefix + 'al' | |
| else: | |
| return G(self.prefix+'o') | |
| if __name__ == '__main__': | |
| g = G() | |
| print(g('al')) | |
| print(g()('al')) | |
| print(g()()('al')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment