python challenge 5

peak hell

Challenge 5 is called peak hell, it presents you with a picture of a hill and the hint ‘pronounce it’. Pickle, is what they are hinting at, but I already knew that as I have been here before. This one cannot be solved with ruby, as ruby has no pickle module. I could have reused the first solution I used so many month ago, but I thought I could do better. Indeed my new solution is a small fraction of the size of the orginal;

#!/usr/bin/env python
import pickle
banner = open('./banner.p')
p = pickle.load(banner)
for pp in p:
        x=""
        for ppp in pp:
                x = x + ppp[0]*ppp[1]
        print x
banner.close()

The first time I used while loops and a bit of other junk that really added nothing to script. They both reveal the same bit of ascii art-text pointing to the next challenge.

Next: Challenge 6; now there are pairs

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s