Created
May 21, 2017 16:48
-
-
Save sat0b/5a3422751d84a094e4eeabaedb82377a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import sys | |
| def main(eq): | |
| eq = eq.replace("=", "==") | |
| for i in range(0, 10): | |
| try: | |
| if eval(eq.replace("X", str(i))): | |
| print("X=%d" % i) | |
| return | |
| except SyntaxError: | |
| pass | |
| print("X=none") | |
| main(sys.argv[1]) |
This file contains hidden or 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
| #!/bin/bash | |
| set -eu | |
| echo "Input : 123+4X6=X79, Answer : X=5" | |
| python hukumen.py "123+4X6=X79" | |
| echo "Input : XX22+89=X2XX, Answer : X=1" | |
| python hukumen.py "XX22+89=X2XX" | |
| echo "Input : 12X+4X6=X79, Answer : X=none" | |
| python hukumen.py "12X+4X6=X79" | |
| echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment