Why Python don't accept 03 as a number?

Richard Damon Richard at Damon-Family.org
Sat Dec 8 19:34:33 EST 2018


On 12/8/18 6:23 PM, Avi Gross wrote:
> [DISCLAIMER: less about python than analysis of a puzzle]
>
> Richard,
>
> Thank you for pointing out that c in the puzzle is constrained. That
> explains why my 320 answers are too many. It cannot be 0 as "a" is always
> zero and it cannot be the three other values that b,d,e are using at the
> time. So my earlier solution should say c is any of six available choices. 
>
> So 6 * 32 is 192 solutions.
>
> Your analysis requires considering a carry from the right column into the
> left. I skipped that by converting something like ab to 10*a+b.
>
> This all began with someone trying to enter 03 which suggests they may have
> been starting to look at it your way. As a logic puzzle to do those with
> pencil and paper, your analysis is spot on. There is additional info to be
> gleaned by looking at adding columns. I chose a perspective on more brute
> force methods and whittled it down to less forceful. Given that c was
> removed from the equation, though, and that only 6 of 10 options are
> available for any given time, I would need another pass at the answers and
> for each solution for the others (b,d,e if we agree a is always 0) I would
> need to make six entries with c set successively to digits-set(0,b,d,e} or
> something like that.
>
> I note that programming some of the kinds of analysis some of these puzzles
> use is not as easy in programming languages as a more brute-force approach
> that computers are better at than humans. 
Actually, part of my point was that we are often tempted to go simple
brute force when a bit of analysis can often vastly simplify the problem
to be solved.

Now, the brute force program, if done right, could also handle other
related problems like SEND+MORE=MONEY

But now, the input equation isn't controlled by the program, so you need
to be very careful about using it for something that gets sent to eval,
and by the time you take that care, perhaps it is easier to do the safer
way.

-- 
Richard Damon




More information about the Python-list mailing list