On Tue, Dec 11, 2018 at 1:12 PM Avi Gross wrote:
> I would then "generate" all possible combinations of digits 0-9 of length N.
> There are an amazing number of ways to do that ranging from taking a
> range(10**N) and converting it to a string then a list of numeral characters
> then tossing ou
onary and pruning any attempts if the word you are building
wanders off a leaf. Another story.
I apologize for the length. The main question was whether eval is particularly
expensive.
-Original Message-----
From: Python-list On
Behalf Of Antoon Pardon
Sent: Monday, December 10, 2018 5:00 A
On 10/12/18 11:16, Chris Angelico wrote:
> On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon 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
On Mon, Dec 10, 2018 at 10:31 PM wrote:
>
> Chris Angelico於 2018年12月10日星期一 UTC+8下午7時09分01秒寫道:
> > 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
Chris Angelico於 2018年12月10日星期一 UTC+8下午7時09分01秒寫道:
> On Mon, Dec 10, 2018 at 9:46 PM wrote:
> >
> > Chris Angelico於 2018年12月10日星期一 UTC+8下午6時17分14秒寫道:
> > > On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon
> > > wrote:
> > > >
> > > > On 10/12/18 11:03, Chris Angelico wrote:
> > > > > Considering tha
On Mon, Dec 10, 2018 at 9:46 PM wrote:
>
> Chris Angelico於 2018年12月10日星期一 UTC+8下午6時17分14秒寫道:
> > On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon wrote:
> > >
> > > On 10/12/18 11:03, Chris Angelico wrote:
> > > > Considering that, in a problem of that description, neither S nor M
> > > > may repres
Chris Angelico於 2018年12月10日星期一 UTC+8下午6時17分14秒寫道:
> On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon 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.
> >
>
On Mon, Dec 10, 2018 at 9:11 PM Antoon Pardon 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
On 10/12/18 11:03, Chris Angelico wrote:
> On Mon, Dec 10, 2018 at 9:01 PM Antoon Pardon wrote:
>> On 8/12/18 06:00, Cameron Simpson wrote:
>>> On 07Dec2018 20:24, Jach Fong wrote:
Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
> What is it exactly that you're trying to accomplish with this? P
On 8/12/18 07:59, Serhiy Storchaka wrote:
> 08.12.18 03:17, jf...@ms4.hinet.net пише:
> 00
>> 0
> 03
>> File "", line 1
>> 03
>> ^
>> SyntaxError: invalid token
>
>
> In Python 3.8 the error message will be more informative:
>
03
> File "", line 1
> SyntaxError: leading
On Mon, Dec 10, 2018 at 9:01 PM Antoon Pardon wrote:
>
> On 8/12/18 06:00, Cameron Simpson wrote:
> > On 07Dec2018 20:24, Jach Fong wrote:
> >> Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
> >>> What is it exactly that you're trying to accomplish with this? Perhaps
> >>> there's a better way than usi
On 8/12/18 06:00, Cameron Simpson wrote:
> On 07Dec2018 20:24, Jach Fong wrote:
>> Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
>>> What is it exactly that you're trying to accomplish with this? Perhaps
>>> there's a better way than using eval.
>>
>> This problem comes from solving a word puzzle,
>>
On 8/12/18 09:35, Ian Kelly wrote:
> On Fri, Dec 7, 2018 at 11:56 PM Henrik Bengtsson
> wrote:
>> A comment from the sideline: one could imagine extending the Python syntax
>> with a (optional) 0d prefix that allows for explicit specification of
>> decimal values. They would "complete" the family:
On Sat, Dec 8, 2018 at 7:57 PM wrote:
>
> Grant Edwards於 2018年12月9日星期日 UTC+8上午12時52分04秒寫道:
> > Just to be clear: you do _not_ want to use eval on the string.
> >
> > If you're not the one who created the string, it might wipe your hard
> > drive or empty your bank account. If you _are_ the one wh
;any digit', 'd': 4, 'e': 9}
> {'a': 0, 'b': 6, 'c': 'any digit', 'd': 1, 'e': 7}
> {'a': 0, 'b': 6, 'c': 'any digit', 'd': 2, 'e': 8}
> {
Grant Edwards於 2018年12月9日星期日 UTC+8上午12時52分04秒寫道:
> On 2018-12-08, Cameron Simpson wrote:
> > On 07Dec2018 20:24, Jach Fong wrote:
> >>Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
> >>> What is it exactly that you're trying to accomplish with this? Perhaps
> >>> there's a better way than using eval.
>
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
: Saturday, December 8, 2018 5:30 PM
To: python-list@python.org
Subject: Re: Why Python don't accept 03 as a number?
On 12/8/18 12:40 PM, Avi Gross wrote:
> You are solving for: ab + aa + cd == ce
Actually, an even quicker analysis for this particular problem is:
from the 10s digits, a + a
On 12/8/18 12:40 PM, Avi Gross wrote:
> You are solving for: ab + aa + cd == ce
Actually, an even quicker analysis for this particular problem is:
from the 10s digits, a + a + c + carryin = c
Thus a and carryin must both be 0 (carryin can not be negative, nor any
of the variables)
thus the final
'e': 8}
{'a': 0, 'b': 6, 'c': 'any digit', 'd': 3, 'e': 9}
{'a': 0, 'b': 7, 'c': 'any digit', 'd': 1, 'e': 8}
{'a': 0, 'b': 7, 'c': 'any
On 2018-12-08, Cameron Simpson wrote:
> On 07Dec2018 20:24, Jach Fong wrote:
>>Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
>>> What is it exactly that you're trying to accomplish with this? Perhaps
>>> there's a better way than using eval.
>>
>>This problem comes from solving a word puzzle,
>>ab
On 12/7/18 11:24 PM, jf...@ms4.hinet.net wrote:
> Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
>> What is it exactly that you're trying to accomplish with this? Perhaps
>> there's a better way than using eval.
> This problem comes from solving a word puzzle,
> ab + aa + cd == ce
> Each character wi
Avi Gross at 2018/12/8 UTC+8 PM2:09:20 wrote:
> [[READERS DIGEST CONDENSED ANSWER: use int("string") ]]
>
> Since we all agree python will not make notations like "05" work
> indefinitely, and the need expressed is how to solve a symbolic puzzle (see
> message below) then it makes sense to look at
08.12.18 08:53, Henrik Bengtsson пише:
A comment from the sideline: one could imagine extending the Python syntax
with a (optional) 0d prefix that allows for explicit specification of
decimal values. They would "complete" the family:
* 0b: binary number
* 0o: octal number
* 0d: decimal number
*
On Fri, Dec 7, 2018 at 11:56 PM Henrik Bengtsson
wrote:
>
> A comment from the sideline: one could imagine extending the Python syntax
> with a (optional) 0d prefix that allows for explicit specification of
> decimal values. They would "complete" the family:
>
> * 0b: binary number
> * 0o: octal n
08.12.18 03:17, jf...@ms4.hinet.net пише:
00
0
03
File "", line 1
03
^
SyntaxError: invalid token
In Python 3.8 the error message will be more informative:
03
File "", line 1
SyntaxError: leading zeros in decimal integer literals are not
permitted; use an 0o prefix for o
A comment from the sideline: one could imagine extending the Python syntax
with a (optional) 0d prefix that allows for explicit specification of
decimal values. They would "complete" the family:
* 0b: binary number
* 0o: octal number
* 0d: decimal number
* 0x: hexadecimal number
I understand that
iginal Message-
From: Python-list On
Behalf Of jf...@ms4.hinet.net
Sent: Friday, December 7, 2018 11:25 PM
To: python-list@python.org
Subject: Re: Why Python don't accept 03 as a number?
Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
> What is it exactly that you're trying to accomplish
On 07Dec2018 20:24, Jach Fong wrote:
Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
What is it exactly that you're trying to accomplish with this? Perhaps
there's a better way than using eval.
This problem comes from solving a word puzzle,
ab + aa + cd == ce
Each character will be translate to a
I can understand the difficulty of throwing old thing away and accept new one
in human. There seems have a huge inertia there. This phenomenon appears on
every aspects, not only on the transition from Python2 to Python3. But, as a
new comer of Python like me, I have no difficulty to accept it be
Ian at 2018/12/8 UTC+8 AM11:28:34 wrote:
> What is it exactly that you're trying to accomplish with this? Perhaps
> there's a better way than using eval.
This problem comes from solving a word puzzle,
ab + aa + cd == ce
Each character will be translate to a digit and evaluate the correctness,
On 2018-12-08 03:49, Joe Pfeiffer wrote:
jf...@ms4.hinet.net writes:
MRAB at 2018/12/8 UTC+8 AM10:04:51 wrote:
Before Python 3, a leading 0 in an integer literal would indicate an
octal (base 8) number.
So, the reason is historical.
The old form is now invalid in order to reduce the chance
jf...@ms4.hinet.net writes:
> MRAB at 2018/12/8 UTC+8 AM10:04:51 wrote:
>> Before Python 3, a leading 0 in an integer literal would indicate an
>> octal (base 8) number.
>
> So, the reason is historical.
>
>> The old form is now invalid in order to reduce the chance of bugs.
>
> I encounter this
On Fri, Dec 7, 2018 at 7:47 PM wrote:
>
> MRAB at 2018/12/8 UTC+8 AM10:04:51 wrote:
> > Before Python 3, a leading 0 in an integer literal would indicate an
> > octal (base 8) number.
>
> So, the reason is historical.
>
> > The old form is now invalid in order to reduce the chance of bugs.
>
> I e
On Sat, Dec 8, 2018 at 1:46 PM wrote:
>
> MRAB at 2018/12/8 UTC+8 AM10:04:51 wrote:
> > Before Python 3, a leading 0 in an integer literal would indicate an
> > octal (base 8) number.
>
> So, the reason is historical.
>
> > The old form is now invalid in order to reduce the chance of bugs.
>
> I e
MRAB at 2018/12/8 UTC+8 AM10:04:51 wrote:
> Before Python 3, a leading 0 in an integer literal would indicate an
> octal (base 8) number.
So, the reason is historical.
> The old form is now invalid in order to reduce the chance of bugs.
I encounter this problem on trying to do something like th
On 2018-12-08 01:17, jf...@ms4.hinet.net wrote:
00
0
03
File "", line 1
03
^
SyntaxError: invalid token
Any particular reason?
Before Python 3, a leading 0 in an integer literal would indicate an
octal (base 8) number.
In Python 2.7:
>>> 010
8
That notation was borrowed
Às 01:17 de 08/12/18, jf...@ms4.hinet.net escreveu:
00
> 0
03
> File "", line 1
> 03
> ^
> SyntaxError: invalid token
>
> Any particular reason?
>
Not sure but I think that after 0 it expects x for hexadecimal, o for
octal, b for binary, ... may be others.
0xa
10
0o10
38 matches
Mail list logo