Think before you do!

Yesterday there was a Python Riddle competition on EuroPython. I did quite well, but I didn’t know how well until I saw the results. Then I realized how stupid thing I did to NOT win MacBook. Here’s the short story.

The rules were simple – who solves most tasks win. If there’s a draw, shorter solution (one-liner) to “A” wins. These are the results:

https://ep2012.europython.eu/pyddle

What does it mean that “he forgot the import in the one-liner” written near my name? It means that instead of sending this:

import math;sum(map(int,str(math.factorial(1000))))

I sent this:

sum(map(int,str(math.factorial(1000))))

The “longer” solution above was 51 characters long, so it was the winning one. But instead of thinking (it was 11 p.m., after a whole day on the conference), I copied the wrong line from ipython. And – poof! – the victory is gone! Hard lesson for me… ;)

And congratulation for the winner – some say that winning is an art of making less mistakes than the others do. Well, hard for me to disagree today – good job Marcin! :)

By the way, it wasn’t the shortest solution possible. For now – after the competition – we have this one (50 characters):

import math;sum(map(int,str(math.factorial(1e3))))

Well… ;)

Comments are closed.