Created
February 6, 2020 18:59
-
-
Save jakevossen5/542cdc6b392cd0513cebc15d5e27d1ec to your computer and use it in GitHub Desktop.
A one liner for a binary to decimal created to demonstrate bad code
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
while (n := ((print(c[1])) if not (c := ((True, "OUTPUT error ") if -1 in (n := [(lambda t: 2**int(t[0]) if t[1] == '1' else (-1 if t[1] not in ['0', '1'] else 0))(t) for t in enumerate(input('BINARY-STR> ')[::-1])]) else (True, "OUTPUT " + str(sum(n)))) if (input('OPTION> ') == '1') else (False, "OUTPUT goodbye!"))[0] else print(c[1]) or (True if 'y' in (lower_in := input('CONTINUE> ').lower()) else print('OUTPUT goodbye!')))): continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment