Created
August 19, 2014 23:36
-
-
Save typedt/d9f53a158f13987c8f8e to your computer and use it in GitHub Desktop.
Solution to Problem 5 of PythonChallenge.com
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
#! /usr/bin/env python | |
# Using pickle to unpickle banner.p | |
import pickle | |
from __future__ import print_function | |
from operator import add | |
def draw_segment(t): | |
k, v = t | |
return k * v | |
def draw_line(line): | |
return reduce(add, map(draw_segment, line)) + '\n' | |
with open('banner.p', 'rb') as f: | |
banner = pickle.load(f) | |
canvas = reduce(add, map(draw_line, banner)) | |
print (canvas) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment