so... for a few days i've been revising this Code (in Gauche / Lisp / Scheme)
to make it run faster.. and last night i could improve it enough to give me
the result i wantedin 72 minutes or so (on my slow PC at home).
( Maybe... within a few months, i'll write the same
Count how many zeros are at the end of your int:
defend_zeros(num):
s = str(num)
return len(s) - len(s.rstrip("0"))
print(end_zeros(10)) # == 1
print(end_zeros(101)) # == 0
print(end_zeros(245))
is [comprehension] the right word???
i swear i never heard the word before
getting into Python a few years ago.
What was it called in the Lisp (Scheme) world
ok... in Common Lisp, (and MacLisp) it was Loop and Collect
https://en.wikipedia.org/wiki/List_comprehension#Hi
is Comp.Lang.Python very active
why is a linear search thru a Tuple slower
(than thru a (corresponding) List ) ???
sometimes, i 'd like to put meaningless indentations
like i do (twice) below
( how ca
On Monday, February 20, 2023 at 5:45:39 PM UTC-8, Paul Rubin wrote:
> Hen Hanna writes:
> > is [comprehension] the right word???
> Yes, it comes from math, particularly set theory. An expression like
>
> { n | n:integer, n mod 2 = 0 }
>
> is called a set comprehen
For a while, i've been curious about a [Tuple Comprehension]
So finally i tried it, and the result was a bit surprising...
X= [ x for x in range(10) ]
X= ( x for x in range(10) )
print(X)
a= list(X)
print(a)
--
https://mail.python.org/mailman/listinfo/python-list
On Monday, February 20, 2023 at 7:57:14 PM UTC-8, Michael Torrie wrote:
> On 2/20/23 20:36, Hen Hanna wrote:
> > For a while, i've been curious about a [Tuple Comprehension]
> I've never heard of a "Tuple comprehension." No such thing exists as
> far as I know.
On Tuesday, February 21, 2023 at 9:33:29 AM UTC-8, Axy wrote:
> On 21/02/2023 04:13, Hen Hanna wrote:
> >
> > (A) print( max( * LisX ))
> > (B) print( sum( * LisX )) <--- Bad syntax !!!
> >
> > What's most surprising is (A) is ok, and (B)
what editor do you (all) use to write Python code? (i use Vim)
yesterday (?) i started noticing this with Bing search
e.g. i type [synonymrich] whch gives several synonyms,
and so (next) i try to replace [rich] by
something like
On Tuesday, February 21, 2023 at 10:39:54 AM UTC-8, Thomas Passin wrote:
> On 2/21/2023 12:32 PM, Axy via Python-list wrote:
> > On 21/02/2023 04:13, Hen Hanna wrote:
> >>
> >> (A) print( max( * LisX ))
> >> (B) print
> py bug.py
Traceback (most recent call last):
File "C:\Usenet\bug.py", line 5, in
print( a + 12 )
TypeError: can only concatenate str (not "int") to str
Why doesn't Python (error msg) do the obvious thing and tell me
WHA
On Wednesday, February 22, 2023 at 2:32:57 AM UTC-8, Anton Shepelev wrote:
> Hello, all.
>
> Does Python have an instrospection facility that can
> determine to which outer variable a function argument is
> bound, e.g.:
>
> v1 = 5;
> v2 = 5;
do some Python coders like to end lines with
On Monday, February 20, 2023 at 5:45:39 PM UTC-8, Paul Rubin wrote:
> Hen Hanna writes:
> > is [comprehension] the right word???
> Yes, it comes from math, particularly set theory. An expression like
>
> { n | n:integer, n mod 2 = 0 }
>
> is called a set comprehen
it seems like a few weeks ago... but
actually it was more like 30 years ago
that i was programming in C, and
i'd get
[Segmentation Fault] (core dumped)
[Bus Error] (core dumped)
[access violation] (core dumped)
On Wednesday, February 22, 2023 at 12:05:34 PM UTC-8, Hen Hanna wrote:
> > py bug.py
> Traceback (most recent call last):
> File "C:\Usenet\bug.py", line 5, in
> print( a + 12 )
> TypeError: can only concatenate str (not "int") to str
>
>
>
On Wednesday, February 22, 2023 at 3:46:21 PM UTC-8, Hen Hanna wrote:
> On Wednesday, February 22, 2023 at 12:05:34 PM UTC-8, Hen Hanna wrote:
> > > py bug.py
> > Traceback (most recent call last):
> > File "C:\Usenet\bug.py", line 5, in
> >
On Wednesday, February 22, 2023 at 6:21:13 PM UTC-8, Rob Cliffe wrote:
> On 23/02/2023 02:04, Thomas Passin wrote:
> > On 2/22/2023 7:58 PM, avi.e...@gmail.com wrote:
> >>
> >>
> >> So can anyone point to places in Python where a semicolon is part of
> >> a best
> >> or even good way to do an
On Wednesday, February 22, 2023 at 11:57:45 PM UTC-8, Barry wrote:
> > On 23 Feb 2023, at 01:39, Hen Hanna wrote:
> >
> > On Wednesday, February 22, 2023 at 3:46:21 PM UTC-8, Hen Hanna wrote:
> >> On Wednesday, February 22, 2023 at 12:05:34 PM UTC-8, Hen Han
Python's Error-Msg genie (Jeannie) is cute and fickle... She sometimes
teases me by not telling me what the VALUE of the "int" is
( "That's for me to know, and for you to find out!" )
as in:
TypeError: can only concatenate str (not "int
in a LaTeX file, after the (1st) \end{document} line,
i can put any random Junk i want(afterwards) until the end of the
file.
Is there a similar Method for a.py file ?
Since i know of no such trick, i sometimes put this (below) at the end of a
.py file.
On Thursday, February 23, 2023 at 9:17:05 PM UTC-8, Thomas Passin wrote:
> On 2/23/2023 7:21 PM, Hen Hanna wrote:
> >
> > in a LaTeX file, after the (1st) \end{document} line,
> > i can put any random Junk i want (afterwards) until the end of the file.
> >
> &g
i just wrote a program, which...
within[FunFunPython]
finds: (funny,futon,python)
( 5- and 6- letter words )
(my program uses a Trie, but is pretty simple)
Maybe someone would show me
how it
On Friday, February 24, 2023 at 10:34:31 AM UTC-8, Hen Hanna wrote:
> i just wrote a program, which...
>within [FunFunPython]
>finds: (funny, futon, python)
>
>( 5- and 6- letter words )
>
>
> (my pro
TypeError: can only concatenate str (not "int") to str
thanks for the comments, --- esp. 2 or 3 (?) ppl who directly addressed it
or commented on it.
py and pypy don't tell me what the (offending) int is
(even tho' it'd be easy to s
On Friday, February 24, 2023 at 1:18:28 PM UTC-8, David Raymond wrote:
> > Find 6-letter words that are hidden (embedded) within each row of letters.
> > The letters are in the correct order.
> >
> > 1. JSOYOMFUBELR
> > 2. SCDUARWDRLYE
> > 3. DASNAGEFERTY
> > 4. CLULOOTSCEHN
> > 5. USENEARSE
-8, dn wrote:
> On 25/02/2023 09.36, Hen Hanna wrote:
> > TypeError: can only concatenate str (not "int") to str
> >
> > thanks for the comments, --- esp. 2 or 3 (?) ppl who directly addressed it
> > or commented on it.
> If you haven't already, please
when i unpack the string (or Seed)USENEARSEYNE ,
i getwords like Sense, Sears, , Snare,
Unary,
(sarsen, seesee, senary, serene, unease, uneasy, usneae, usneas)
(sensyne)
How would i approach the PACKING function ?
e.g. ... i want to fi
On Saturday, February 25, 2023 at 4:54:36 PM UTC-8, Greg Ewing wrote:
> On 26/02/23 10:53 am, Paul Rubin wrote:
> > I'm not on either list but the purpose of the tutor list is to shunt
> > beginner questions away from the main list.
> There's a fundamental problem with tutor lists.
On Saturday, February 25, 2023 at 1:54:14 PM UTC-8, Paul Rubinwrote:
> Hen Hanna writes:
> > is this guy (dn) always this rude??? is he even more rude on this
> > Python-Tutor list ?
> I'm not on either list but the purpose of the tutor list is to shunt
> be
On Thursday, March 4, 2021 dn wrote:
> Hi, and welcome to the list.
note that this is the very same rude guy ('dn') who is apparently the rudest
of them all.
note that this is the very same rude guy ('dn') who wants to shunt me away to
the TUTOR list.
--- i guess
i received thiscreepy email... Subj: Just to you.
>>>Just to you as I see little further reason to help you ...
>>>You have not taken hints that bashing the language as not doing what you
>>> expect is not the way to get help so I leave you to others.
i'll che
On Saturday, February 25, 2023 at 9:52:35 PM UTC-8, Chris Angelico wrote:
> On Sun, 26 Feb 2023 at 16:23, Hen Hanna wrote:
> >
> >
> > On Thursday, March 4, 2021 dn wrote:
> > > Hi, and welcome to the list.
> >
> >
> > note that this is the
On Wednesday, February 22, 2023 at 10:38:00 PM UTC-8, Greg Ewing wrote:
> On 23/02/23 9:37 am, Hen Hanna wrote:
> > for the first several weeks... whenever i used Python... all i could think
> > ofwas this is really Lisp (inside) with a thin veil of
> &g
def Lisprint(x): print( ' (' + ', '.join(x) + ')' , '\n')
a=' a b c ? def f x if zero? x 0 1 '
a += ' A B C ! just an example '
x= a.split()
print(x)
Lisprint(x)
['a', 'b', 'c', '?', 'def', 'f', 'x', 'if', 'zero?', 'x', '0', '1', 'A', 'B',
'C', '!', 'just', 'an', 'example']
(a, b,
On Saturday, February 25, 2023 at 11:45:12 PM UTC-8, Hen Hanna wrote:
> def Lisprint(x): print( ' (' + ', '.join(x) + ')' , '\n')
>
> a= ' a b c ? def f x if zero? x 0 1 '
> a += ' A B C ! just an example '
> x= a.spli
within Vim, do
:smile
___
To move text-Lines between files --- i do this (below) Maybe there's a
better (or more standard) way, but i've been doing this for 30+ years, so i'll
prob. keep doing it.
i have these in my .vimrc file.
Re-indenting Lisp code is =%
and it works really well !
(define (foo x)
(dotimes (i 100)
(bar bar x)))
--- it doesn't work as well for Python code.
(doing 5==
On Sunday, February 26, 2023 at 6:41:01 AM UTC-8, Thomas Passin wrote:
> On 2/25/2023 8:12 PM, Hen Hanna wrote:
> > 2. the rude guy ('dn') hasn't offered a single word of comment that's
> > directly relevant to it.
> > > but he did offer
On Monday, August 29, 2022 at 7:18:22 PM UTC-7, Paul Rubin wrote:
> Just because.
>
> from math import gcd
> def fizz(n: int) -> str:
>match gcd(n, 15):
> case 3: return "Fizz"
> case 5: return "Buzz"
> case 15: return "FizzBuzz"
>
Rob Cliffe should stop sending me rude email messages.
At the very least, Rob Cliffe should stop sending me ANY email messages, if
he doesn't intend to an email i've sent him.
--
https://mail.python.org/mailman/listinfo/python-list
On Sunday, February 26, 2023 at 10:28:41 AM UTC-8, rbowman wrote:
> On Sun, 26 Feb 2023 09:17:46 -0800 (PST), Hen Hanna wrote:
>
>
> > To move text-Lines between files --- i do this (below) Maybe
> > there's a better (or more standard) way, but i've been do
didn't get
through, apparently)
were among the few that were relevant.
On Sunday, February 26, 2023 at 10:10:09 AM UTC-8, Hen Hanna wrote:
> Rob Cliffe should stop sending me rude email messages.
>
>
> At the very least, Rob Cliffe should s
42 matches
Mail list logo