Created
April 7, 2017 01:54
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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