Skip to content

Instantly share code, notes, and snippets.

@kgullion
Created Apr 7, 2017
Embed
What would you like to do?
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