[Baypiggies] Code/Idea Review (WARNING: SPOILER)

Glen Jarvis glen at glenjarvis.com
Sun Dec 16 01:01:00 CET 2007

    The challenge start off with such a basic level, there is NO  
programming level necessary. In fact, I imagine most people solve  
riddle zero without writing any code. Although it wasn't necessary, I  
wrote a small program just so I could have a program for every riddle.

    In riddle zero, we have a photo of three numbers. That alone  
doesn't give us much of a clue. BUT, look at the hint that is given:  
"Hint: Try to change the url address."

The URL address for this riddle is "http://www.pythonchallenge.com/pc/ 

Hmm.. there's a file called 0.html that is being served on the  
internet. And, there is a photo of three numbers. I wonder what URL  
they would want us to try? You can type this URL without any python  
knowledge. What do you think the answer is? I bet this gets you  
started. And, the message that you receive is another clue.

Warmest Regards,

Glen Jarvis
glen at glenjarvis.com

"You must be the change you wish to see in the world." -M. Gandhi

On Dec 15, 2007, at 11:58 AM, Tony Cappellini wrote:

> Hello Glen,
> Welcome to the Bay Aeea and baypiggies!
> Regarding the python challenge- I hadn't seen this before, and I have
> no web programming experience.
> I am quite surprised to find this statement in the FAQ for the  
> python challenge
> "What level of Python knowledge is required for solving the riddles?
> The riddles are designed to be solvable by Python newcomers and yet
> challenging even for Python experts. If you don't know how to do a
> certain thing in Python or you are referenced to an unfamiliar module
> - treat it as an opportunity to learn it. Google is your friend."
> I find it hard to believe that someone new to python would be able to
> solve #0  without having extensive web programming experience.
> Ill have to look at the  other riddles.
> On Dec 15, 2007 11:23 AM, Glen Jarvis <glen at glenjarvis.com> wrote:
>> As a recent transplant to the Bay Area, I must say that I never
>> realized how much of a geek haven this was. I knew it would be richer
>> in geeks, but I did not know moving here would be one of the smartest
>> decisions I ever made!
>> I went to my second Bay Piggies meeting. And, I had an incredible
>> time. JJ was absolutely awesome and allowed me to ride with him. And,
>> he, his co-worker, several people he socialized with, and myself had
>> some incredible conversations for several hours. You can't help but
>> genuinely like all of these guys. They're fun to talk to, smart, and
>> just 'get it' instead of getting board or eyes glassing over.
>> And, I'm usually a very big duck in a little puddle. At BayPIGgies,
>> I'm an itty bitty new duckling, wet behind the ears. And, there are
>> so many people who genuinely want to help.
>> I learned two really incredible things this time: PEP-8 and the
>> Python Challenge. Because of the talk, I discovered the Python
>> Challenge (http://www.pythonchallenge.com/). What a great way to
>> challenge ourselves. The first two (0, and 1) were real easy
>> challenges. However, instead of just marching on, I am trying to be a
>> code nazi. I want to keep the code for each of these challenges, I
>> want it to pass a PEP-8 level code review, and I want it to be the
>> most 'intelligent' choice for the objective.
>> In challenge 1, I was able to create some python code fairly quickly
>> to translate the text enough to catch the gist fairly quickly.
>> However, as a typical non-python coder, I used a loop instead of
>> string.maketrans(). After reading the string module help, I was able
>> to keep reducing and rewriting this until it was closer to what I
>> thought the challenge wanted us to do.
>> I would like it, if you don't mind, if you gave me a thorough peer
>> review for such a small piece of code. I want to know anytime I break
>> convention with PEP-8. Also, if I received replies like "crap code,
>> dude." that, unfortunately is not helpful. What would be helpful if I
>> heard *why* it was crap so I could learn from it. The same is true
>> for "cool code." That doesn't tell me what my weaknesses or strengths
>> are.
>> I believe lines 6 and 7 can be reduced to be more readable and better
>> written. If any (or all) can oblige, I would love to learn. Be
>> warned, however, that this is a solution to the second Python
>> Challenge. You should do the first two challenges yourself so there
>> are no spoilers.
>> I *heart* BayPIGgies!
>> Cheers,
>> Glen
>> Chief Gumby on a Bicycle (i.e., the dork who has a busted shoulder)
>> --
>> 415-680-3964
>> glen at glenjarvis.com
>> http://www.glenjarvis.com
>> "You must be the change you wish to see in the world." -M. Gandhi
>> 1  #!/usr/bin/env python
>> 2
>> 3  import sys
>> 4  import string
>> 5
>> 6  alpha_list=map(chr, range(ord('a'), ord('z') + 1))
>> 7  alphabet_=string.join(alpha_list, '')
>> 8
>> 9  re_map=alphabet_[2:] + alphabet_[:2]
>> 10
>> 11 trans_table = string.maketrans( alphabet_, re_map)
>> 12
>> 13 print "g  fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr
>> amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw
>> rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu
>> ynnjw ml rfc spj.".translate(trans_table)
>> _______________________________________________
>> Baypiggies mailing list
>> Baypiggies at python.org
>> To change your subscription options or unsubscribe:
>> http://mail.python.org/mailman/listinfo/baypiggies

More information about the Baypiggies mailing list