Skip to content

Instantly share code, notes, and snippets.

@yuheiomori
Created September 29, 2014 10:53
Show Gist options
  • Save yuheiomori/2a5e7807372ffae2e634 to your computer and use it in GitHub Desktop.
Save yuheiomori/2a5e7807372ffae2e634 to your computer and use it in GitHub Desktop.
Big Digits (CodeEval) in python 2.x
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