Why Python don't accept 03 as a number?

jfong at ms4.hinet.net jfong at ms4.hinet.net
Mon Dec 10 06:28:37 EST 2018


Chris Angelico於 2018年12月10日星期一 UTC+8下午7時09分01秒寫道:
> On Mon, Dec 10, 2018 at 9:46 PM <jfong at ms4.hinet.net> wrote:
> >
> > Chris Angelico於 2018年12月10日星期一 UTC+8下午6時17分14秒寫道:
> > > On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon <antoon.pardon at vub.be> wrote:
> > > >
> > > > On 10/12/18 11:03, Chris Angelico wrote:
> > > > > Considering that, in a problem of that description, neither S nor M
> > > > > may represent zero, I don't think there's a problem here.
> > > >
> > > > Not all such problems have that condition.
> > >
> > > They should. Every published set of problems that I've ever solved by
> > > hand has. I went searching online for some, and found this page:
> > >
> > > http://puzzlepicnic.com/genre?alphametic
> > >
> > > which clearly states that exact restriction. The implication is that
> > > you're solving a puzzle in arithmetic (usually addition or long
> > > multiplication), and it is *exactly* as you would have written it with
> > > digits, save that the digits have been replaced with letters (and
> > > carries have been omitted, since that'd make it too easy). You
> > > wouldn't write a leading zero on a number in standard grade-school
> > > arithmetic, so you also won't use a leading zero in anything here.
> > >
> > > ChrisA
> >
> > All I know is that when I write a number 03, there is no any human being will say it's an illegal number.
> >
> 
> Yet most human beings will agree that you don't write out an
> arithmetic problem as:
> 
>    0 1 9 8
>  +   7 1 3
>  =========

Python3 gives me the error message is because of the number 0198, not because of 0198 + 713.

> > I prefer to buy the reason that this restriction was bring in is because of the puzzle's author know it will cause trouble without this, not because of our written habit.
> >
> 
> No, it's a restriction because it is unsatisfactory without it. The
> point of a puzzle is to be fun, and fun means having restrictions that
> fit what people expect.

The fun is from solving the puzzle, not from its restriction, unless the puzzle has no fun without this restriction.

--Jach

> ChrisA



More information about the Python-list mailing list