Created
September 29, 2014 10:53
-
-
Save yuheiomori/2a5e7807372ffae2e634 to your computer and use it in GitHub Desktop.
Big Digits (CodeEval) in python 2.x
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 | |
data = """-**----*--***--***---*---****--**--****--**---**-- | |
*--*--**-----*----*-*--*-*----*-------*-*--*-*--*- | |
*--*---*---**---**--****-***--***----*---**---***- | |
*--*---*--*-------*----*----*-*--*--*---*--*----*- | |
-**---***-****-***-----*-***---**---*----**---**-- | |
--------------------------------------------------""" | |
big_digit_data = zip( | |
*[[e[i:i + 5] for i in xrange(0, len(e), 5)] for e in data.split()]) | |
def convert_big_digits(s): | |
return "\n".join(["".join(ln) for ln in | |
zip(*(big_digit_data[int(c)] for c in s if c.isdigit()))]) | |
def main(): | |
with open(sys.argv[1], "r") as f: | |
for line in f: | |
print convert_big_digits(line) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment