Skip to content

Instantly share code, notes, and snippets.

Created Apr 7, 2017
What would you like to do?
Code checker for Answer-Chaining Fibonacci at
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!')
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