|
|
|
|
|
by bobbyi_settv
4342 days ago
|
|
The "complete" solutions for Python in the repo don't actually work because they don't reset the state. If you add a final line of: print g('al')
for solution1 or: print m('rton')
for solution2, you'll find they don't print gal/ mrton.Here's what I came up with before looking at those solutions that seems to work: def g(arg=None):
if arg == 'al':
return 'gal'
def inner(arg=None):
if arg == 'al':
return 'g' + (inner.counter * 'o') + 'al'
inner.counter += 1
return inner
inner.counter = 1
return inner
|
|
I'd make a solution which resets the state linked by the table though, so please submit one!