Skip to content

Instantly share code, notes, and snippets.

@typedt
Created August 19, 2014 23:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typedt/d9f53a158f13987c8f8e to your computer and use it in GitHub Desktop.
Save typedt/d9f53a158f13987c8f8e to your computer and use it in GitHub Desktop.
Solution to Problem 5 of PythonChallenge.com
#! /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