Skip to content

Instantly share code, notes, and snippets.

@Leonidas-from-XIV
Created July 27, 2014 11:28
Show Gist options
  • Select an option

  • Save Leonidas-from-XIV/715cc67d159ce4983086 to your computer and use it in GitHub Desktop.

Select an option

Save Leonidas-from-XIV/715cc67d159ce4983086 to your computer and use it in GitHub Desktop.
Simple Python solution for g()('al') challenge
#!/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