15
MMMAAANNN
Last seen 6 years ago
Member for 9 years, 2 months, 3 days
Difficulty Normal
Checking for borders (a, h, 1) is actually not necessary, because input is always correct and there are no pawns outside the board. This code can be simplified.
Also you never use your "alphabet" list.
More
Thumbs up for including detailed explanation so everyone can clearly see how it works.
More
There is no need to check for j == 10 actually, you could include this in the next check 10 <= j <=19
More
Why "z"? Maybe "h"?
But actually, you really don't have to check for out-of-bounds pawns, because the input is supposed to be always correct. Those checks are not necessary for success. I made this mistake myself at first though :)
More
It is not very clear, I had to spend some time to understand how it works. But otherwise nice solution.
More
Actually counter can be shortened to:
count += (ch1 in pawns) or (ch2 in pawns)
More
This is much more stable indeed, and quite speedy too. I tried five times, not a single failure! Good job.
More
Not very clear at first glance, but I learned something from this, so thumbs up.
More
I had the idea to use random, but never tried actually. How long does it take to calculate family with 17 people and 5 couples? (I mean the last test, with Louis and others).
More
I've broken it into multiple lines for the purpose of readability only. Will work if all lines joined into one.
More