On 2021-02-20 at 20:49:15 -0800,
Dan Stromberg wrote:
> On Sat, Feb 20, 2021 at 7:13 PM Ming wrote:
>
> > I just wrote a very short code can fulfill your needs:
> >
> > a = 2342
> > b = int("".join(map(lambda x: str((int(x)-3)%10) ,list(str(a)
> >
> I tend to favor plenty of temporary varia
On Sun, Feb 21, 2021 at 3:50 PM Dan Stromberg wrote:
>
> On Sat, Feb 20, 2021 at 7:13 PM Ming wrote:
>
> > I just wrote a very short code can fulfill your needs:
> >
> > a = 2342
> > b = int("".join(map(lambda x: str((int(x)-3)%10) ,list(str(a)
> >
> I tend to favor plenty of temporary variab
On Sat, Feb 20, 2021 at 7:13 PM Ming wrote:
> I just wrote a very short code can fulfill your needs:
>
> a = 2342
> b = int("".join(map(lambda x: str((int(x)-3)%10) ,list(str(a)
>
I tend to favor plenty of temporary variables with descriptive names, but
this is indeed short.
Apart from that,
On Sat, Feb 20, 2021 at 09:40:48AM -0500, C W wrote:
> Hello everyone,
>
> I'm curious if there is a way take number and back each digit by 3 ?
>
> 2342 becomes 9019
> 8475 becomes 5142
> 5873 becomes 2540
>
> The tricky part is that 2 becomes 9, not -1.
> [...]
I just wrote a very short code c
On 21/02/2021 06.02, jak wrote:
> Il 20/02/2021 15:40, C W ha scritto:
>> Hello everyone,
>>
>> I'm curious if there is a way take number and back each digit by 3 ?
>>
>> 2342 becomes 9019
>> 8475 becomes 5142
>> 5873 becomes 2540
>>
>> The tricky part is that 2 becomes 9, not -1.
>>
>> Here's my t
Wouldn't it be nice, Grant, if Homework was assigned with statements like:
"Using only the features of the language covered up to chapter 3, meaning
individual variables and lists of them and simple loops and only using the
arithmetic built-in variable of +, -, % ... Solve this problem "
But
On 20/02/2021 20.25, Wolfgang Stöcher wrote:
> Having a dict like
> d = {'one': 1, 'two': 2}
> the representation of its keys
> repr(d.keys())
> gives
> "dict_keys(['one', 'two'])"
>
> But since the keys are unique, wouldn't a representation using the set
> notation
> be more intuitive, i.e.
On 2/20/2021 12:02 PM, jak wrote:
Il 20/02/2021 15:40, C W ha scritto:
Hello everyone,
I'm curious if there is a way take number and back each digit by 3 ?
2342 becomes 9019
8475 becomes 5142
5873 becomes 2540
The tricky part is that 2 becomes 9, not -1.
Here's my toy example and what I atte
On 2021-02-20, Dan Stromberg wrote:
> Convert to a str.
> Convert to a list of ints, one for each digit
> Add 7 mod 10, for each digit in the list
I'd probably subtract 3 (mod 10), so as to more obviously match the
stated requirement.
> Convert to a list of single-character str's
> Catenate tho
On 2/20/2021 2:25 AM, Wolfgang Stöcher wrote:
Having a dict like
d = {'one': 1, 'two': 2}
the representation of its keys
repr(d.keys())
gives
"dict_keys(['one', 'two'])"
But since the keys are unique, wouldn't a representation using the set
notation
be more intuitive, i.e. what about c
On 2021-02-20, MRAB wrote:
> Have a look at the 'translate' method of the 'str' class.
That's very clever, but being too clever on homework assignemnts
doesn't always get a good grade. If they've just studied iteration,
the modulus operator, and int/str conversions, then I'd avise using
the "dum
Convert to a str.
Convert to a list of ints, one for each digit
Add 7 mod 10, for each digit in the list
Convert to a list of single-character str's
Catenate those str's back together
Convert to a single int
On Sat, Feb 20, 2021 at 6:45 AM C W wrote:
> Hello everyone,
>
> I'm curious if there
Il 20/02/2021 15:40, C W ha scritto:
Hello everyone,
I'm curious if there is a way take number and back each digit by 3 ?
2342 becomes 9019
8475 becomes 5142
5873 becomes 2540
The tricky part is that 2 becomes 9, not -1.
Here's my toy example and what I attempted,
test_series = pd.Series(lis
On 2021-02-20 14:40, C W wrote:
Hello everyone,
I'm curious if there is a way take number and back each digit by 3 ?
2342 becomes 9019
8475 becomes 5142
5873 becomes 2540
The tricky part is that 2 becomes 9, not -1.
Here's my toy example and what I attempted,
test_series = pd.Series(list(['2
Having a dict like
d = {'one': 1, 'two': 2}
the representation of its keys
repr(d.keys())
gives
"dict_keys(['one', 'two'])"
But since the keys are unique, wouldn't a representation using the set
notation
be more intuitive, i.e. what about changing the output of
dict_keys.__repr__ to
On 2021-02-20 at 09:40:48 -0500,
C W wrote:
> Hello everyone,
>
> I'm curious if there is a way take number and back each digit by 3 ?
>
> 2342 becomes 9019
> 8475 becomes 5142
> 5873 becomes 2540
>
> The tricky part is that 2 becomes 9, not -1.
>
> Here's my toy example and what I attempted,
Dino wrote:
> trying to do some dayaviz with Italian Covid Open Data (
> https://github.com/italia/covid19-opendata-vaccini/ )
>
> here's how I pull my data:
>
> import sys
> import urllib.request
> import pandas as pd
> import ssl
> ssl._create_default_https_context
Hello everyone,
I'm curious if there is a way take number and back each digit by 3 ?
2342 becomes 9019
8475 becomes 5142
5873 becomes 2540
The tricky part is that 2 becomes 9, not -1.
Here's my toy example and what I attempted,
> test_series = pd.Series(list(['2342', '8475', '5873']))
> test_se
I have some code that makes use of the typing module.
This code creates several instances of objects it creates
from a library that has some issues.
For example, I have multiple list comps that iterate properties
of those instance and the type checker fails with:
Expected type 'collections.It
Don't have the original email, hence replying this way.
On Sat, Feb 20, 2021 at 12:13:30PM +0100, jak wrote:
> Il 20/02/2021 01:56, Dino ha scritto:
> >
> > trying to do some dayaviz with Italian Covid Open Data (
> > https://github.com/italia/covid19-opendata-vaccini/ )
> >
> > here's how I pull
Il 20/02/2021 01:56, Dino ha scritto:
trying to do some dayaviz with Italian Covid Open Data (
https://github.com/italia/covid19-opendata-vaccini/ )
here's how I pull my data:
import sys
import urllib.request
import pandas as pd
import ssl
ssl._create_default_http
21 matches
Mail list logo