r': 1, 'n':
1}
False
>>> sub_word("supercalifragilisticexpialidocious", "fragile")
SOURCE dict: {'s': 3, 'u': 2, 'p': 2, 'e': 2, 'r': 2, 'c': 3, 'a': 3, 'l':
3, 'i':
Steven D'Aprano wrote:
> We don't need to check that the individual letters are the same, because
> checking the counts will suffice. If they are not the same, one string
> will have (let's say) two A's while the other will have none, and the
> counts will be different.
Another great optimisation
On Fri, Oct 19, 2018 at 09:12:54AM -0700, Pat Martin wrote:
> Sorry my first email didn't have a subject line
>
> TLDR; How do you figure out if code is inefficient (if it isn't necessarily
> obvious) and how do you find a more efficient solution?
You know it is inefficient if it takes longer to
On 19Oct2018 23:07, Alan Gauld wrote:
On 19/10/18 17:12, Pat Martin wrote:
TLDR; How do you figure out if code is inefficient (if it isn't
necessarily obvious) and how do you find a more efficient solution?
Others have addressed most of the issues but I'd just add the caveat
that you can spen
On 19/10/18 17:12, Pat Martin wrote:
> TLDR; How do you figure out if code is inefficient (if it isn't necessarily
> obvious) and how do you find a more efficient solution?
Others have addressed most of the issues but I'd just add the caveat
that you can spend forever trying to make your code "mo
Pat Martin wrote:
> So should we always use sets or dictionaries if possible? Are these more
> efficient because of not keeping track of their position?
Not always. If you want to know how often one entry/char occurs in a linear
storage like a list, a string, or a file, then you can loop over th
So should we always use sets or dictionaries if possible? Are these more
efficient because of not keeping track of their position?
On Fri, Oct 19, 2018 at 10:47 AM Pat Martin wrote:
> That's correct sorry, I reassigned with replace back to string2, I forgot
> that in my retyping of the snippet.
That's correct sorry, I reassigned with replace back to string2, I forgot
that in my retyping of the snippet.
That makes sense, when it comes to strings and it taking so long. Thanks
for explaining that.
On Fri, Oct 19, 2018 at 10:09 AM Peter Otten <__pete...@web.de> wrote:
> Mats Wichmann wrote
Mats Wichmann wrote:
> On 10/19/2018 10:12 AM, Pat Martin wrote:
>> Sorry my first email didn't have a subject line
>>
>> TLDR; How do you figure out if code is inefficient (if it isn't
>> necessarily obvious) and how do you find a more efficient solution?
>
> I think you've hit it in your last
Pat Martin wrote:
> Sorry my first email didn't have a subject line
>
> TLDR; How do you figure out if code is inefficient (if it isn't
> necessarily obvious) and how do you find a more efficient solution?
>
> I use code wars sometimes to get some practice with Python, there was a
> challenge to
On 10/19/2018 10:12 AM, Pat Martin wrote:
> Sorry my first email didn't have a subject line
>
> TLDR; How do you figure out if code is inefficient (if it isn't necessarily
> obvious) and how do you find a more efficient solution?
I think you've hit it in your last sentence ("except maybe write mo
Sorry my first email didn't have a subject line
TLDR; How do you figure out if code is inefficient (if it isn't necessarily
obvious) and how do you find a more efficient solution?
I use code wars sometimes to get some practice with Python, there was a
challenge to compare two strings and if strin
12 matches
Mail list logo