Skip to content

Instantly share code, notes, and snippets.

@kgullion
Created April 7, 2017 01:54
Show Gist options
  • Save kgullion/8d591bc76d3e18e00e31ae64fab32178 to your computer and use it in GitHub Desktop.
Save kgullion/8d591bc76d3e18e00e31ae64fab32178 to your computer and use it in GitHub Desktop.
Code checker for Answer-Chaining Fibonacci at http://codegolf.stackexchange.com/q/115591/32604
def checker(code, restricted):
r = set(restricted)
c = set(code)
chars = {*'\t\n', *map(chr, range(32, 127))}
if c == chars - r:
print('Good to go!')
else:
if r & c:
print('Illegal characters: {}'.format(''.join(r & c)))
if chars - r - c:
print('Leftover characters: {}'.format(''.join(sorted(chars - r - c))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment