Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #196211 > unrolled thread
| Started by | HenHanna <HenHanna@devnull.tb> |
|---|---|
| First post | 2024-06-09 16:42 -0700 |
| Last post | 2024-06-21 06:10 +0000 |
| Articles | 8 — 6 participants |
Back to article view | Back to comp.lang.python
in Python: (101 102 103 201 202 203 301 302 303 401 402 403 ) HenHanna <HenHanna@devnull.tb> - 2024-06-09 16:42 -0700
Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 ) Paul Rubin <no.email@nospam.invalid> - 2024-06-09 21:18 -0700
Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 ) Phil Carmody <pc+usenet@asdf.org> - 2024-06-13 15:01 +0300
Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 ) candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> - 2024-06-14 06:10 +0000
Re: in Python: (101 102 103 201 ...) (Posting On Python-List Prohibited) Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-06-14 07:18 +0000
Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 ) "Peter J. Holzer" <hjp-python@hjp.at> - 2024-06-18 23:26 +0200
Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 ) Phil Carmody <pc+usenet@asdf.org> - 2024-06-20 17:20 +0300
Re: in Python: (101 102 103 201 202 203 301 302 303 401 402 403 ) candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> - 2024-06-21 06:10 +0000
| From | HenHanna <HenHanna@devnull.tb> |
|---|---|
| Date | 2024-06-09 16:42 -0700 |
| Subject | in Python: (101 102 103 201 202 203 301 302 303 401 402 403 ) |
| Message-ID | <v45eka$3s5s4$2@dont-email.me> |
# (101 102 103 201 202 203 301 302 303 401 402 403 )
print( [ x+i for x in range(100,401,100) for i in range(1,4) ] )
is there another (simple) way to write this?
[toc] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2024-06-09 21:18 -0700 |
| Message-ID | <87v82hph0u.fsf@nightsong.com> |
| In reply to | #196211 |
HenHanna <HenHanna@devnull.tb> writes: > is there another (simple) way to write this? Yes, but please consider doing these easy exercises yourself instead of fobbing them onto other people.
[toc] | [prev] | [next] | [standalone]
| From | Phil Carmody <pc+usenet@asdf.org> |
|---|---|
| Date | 2024-06-13 15:01 +0300 |
| Message-ID | <87bk45aw6b.fsf@fatphil.org> |
| In reply to | #196214 |
Paul Rubin <no.email@nospam.invalid> writes:
> HenHanna <HenHanna@devnull.tb> writes:
>> is there another (simple) way to write this?
>
> Yes, but please consider doing these easy exercises yourself instead of
> fobbing them onto other people.
Hen's probably just an experimental GPT. You, with your limited
resources, can never train it.
I'd say you can't beat the verbosity, or lack thereof of just plain zsh/bash:
$ echo {1,2,3,4}0{1,2,3}
101 102 103 201 202 203 301 302 303 401 402 403
Phil
--
We are no longer hunters and nomads. No longer awed and frightened, as we have
gained some understanding of the world in which we live. As such, we can cast
aside childish remnants from the dawn of our civilization.
-- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/
[toc] | [prev] | [next] | [standalone]
| From | candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> |
|---|---|
| Date | 2024-06-14 06:10 +0000 |
| Message-ID | <slrnv6nnel.30ai.candycanearter07@candydeb.host.invalid> |
| In reply to | #196245 |
Phil Carmody <pc+usenet@asdf.org> wrote at 12:01 this Thursday (GMT):
> Paul Rubin <no.email@nospam.invalid> writes:
>> HenHanna <HenHanna@devnull.tb> writes:
>>> is there another (simple) way to write this?
>>
>> Yes, but please consider doing these easy exercises yourself instead of
>> fobbing them onto other people.
>
> Hen's probably just an experimental GPT. You, with your limited
> resources, can never train it.
>
> I'd say you can't beat the verbosity, or lack thereof of just plain zsh/bash:
> $ echo {1,2,3,4}0{1,2,3}
> 101 102 103 201 202 203 301 302 303 401 402 403
>
> Phil
I /think/ you can replace it with {1...4} and {1...3}? I know there is
some syntax for "range of numbers" but I can't remember it exactly.
--
user <candycane> is generated from /dev/urandom
[toc] | [prev] | [next] | [standalone]
| From | Lawrence D'Oliveiro <ldo@nz.invalid> |
|---|---|
| Date | 2024-06-14 07:18 +0000 |
| Subject | Re: in Python: (101 102 103 201 ...) (Posting On Python-List Prohibited) |
| Message-ID | <v4gqsp$2pjn6$1@dont-email.me> |
| In reply to | #196252 |
On Fri, 14 Jun 2024 06:10:06 -0000 (UTC), candycanearter07 wrote:
> I /think/ you can replace it with {1...4} and {1...3}?
Two dots, not three. Bash extension.
[toc] | [prev] | [next] | [standalone]
| From | "Peter J. Holzer" <hjp-python@hjp.at> |
|---|---|
| Date | 2024-06-18 23:26 +0200 |
| Message-ID | <mailman.155.1718748012.2909.python-list@python.org> |
| In reply to | #196252 |
[Multipart message — attachments visible in raw view] — view raw
On 2024-06-14 06:10:06 -0000, candycanearter07 via Python-list wrote:
> Phil Carmody <pc+usenet@asdf.org> wrote at 12:01 this Thursday (GMT):
> > I'd say you can't beat the verbosity, or lack thereof of just plain zsh/bash:
> > $ echo {1,2,3,4}0{1,2,3}
> > 101 102 103 201 202 203 301 302 303 401 402 403
>
>
> I /think/ you can replace it with {1...4} and {1...3}? I know there is
> some syntax for "range of numbers" but I can't remember it exactly.
Only two dots, not three:
% echo {1..4}0{1..3}
101 102 103 201 202 203 301 302 303 401 402 403
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
[toc] | [prev] | [next] | [standalone]
| From | Phil Carmody <pc+usenet@asdf.org> |
|---|---|
| Date | 2024-06-20 17:20 +0300 |
| Message-ID | <87sex7ae6z.fsf@fatphil.org> |
| In reply to | #196252 |
candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
writes:
> Phil Carmody <pc+usenet@asdf.org> wrote at 12:01 this Thursday (GMT):
>> Paul Rubin <no.email@nospam.invalid> writes:
>>> HenHanna <HenHanna@devnull.tb> writes:
>>>> is there another (simple) way to write this?
>>>
>>> Yes, but please consider doing these easy exercises yourself
>>> instead of
>>> fobbing them onto other people.
>>
>> Hen's probably just an experimental GPT. You, with your limited
>> resources, can never train it.
>>
>> I'd say you can't beat the verbosity, or lack thereof of just plain
>> zsh/bash:
>> $ echo {1,2,3,4}0{1,2,3}
>> 101 102 103 201 202 203 301 302 303 401 402 403
>
> I /think/ you can replace it with {1...4} and {1...3}? I know there is
> some syntax for "range of numbers" but I can't remember it exactly.
You're right, but it's even shorter -
$ echo {1..4}0{1..3}
101 102 103 201 202 203 301 302 303 401 402 403
Good golfing!
Phil
--
We are no longer hunters and nomads. No longer awed and frightened, as we have
gained some understanding of the world in which we live. As such, we can cast
aside childish remnants from the dawn of our civilization.
-- NotSanguine on SoylentNews, after Eugen Weber in /The Western Tradition/
[toc] | [prev] | [next] | [standalone]
| From | candycanearter07 <candycanearter07@candycanearter07.nomail.afraid> |
|---|---|
| Date | 2024-06-21 06:10 +0000 |
| Message-ID | <slrnv7a5pt.5022.candycanearter07@candydeb.host.invalid> |
| In reply to | #196300 |
Phil Carmody <pc+usenet@asdf.org> wrote at 14:20 this Thursday (GMT):
> candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
> writes:
>
>> Phil Carmody <pc+usenet@asdf.org> wrote at 12:01 this Thursday (GMT):
>>> Paul Rubin <no.email@nospam.invalid> writes:
>>>> HenHanna <HenHanna@devnull.tb> writes:
>>>>> is there another (simple) way to write this?
>>>>
>>>> Yes, but please consider doing these easy exercises yourself
>>>> instead of
>>>> fobbing them onto other people.
>>>
>>> Hen's probably just an experimental GPT. You, with your limited
>>> resources, can never train it.
>>>
>>> I'd say you can't beat the verbosity, or lack thereof of just plain
>>> zsh/bash:
>>> $ echo {1,2,3,4}0{1,2,3}
>>> 101 102 103 201 202 203 301 302 303 401 402 403
>>
>> I /think/ you can replace it with {1...4} and {1...3}? I know there is
>> some syntax for "range of numbers" but I can't remember it exactly.
>
> You're right, but it's even shorter -
> $ echo {1..4}0{1..3}
> 101 102 103 201 202 203 301 302 303 401 402 403
>
> Good golfing!
>
> Phil
Thanks :D
--
user <candycane> is generated from /dev/urandom
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web