On 2020-11-03, duncan smith <duncan@invalid.invalid> wrote:
>> 
>
>>>> from collections import Counter
>>>> letters = 'att'
>>>> letter_counts = Counter(letters)
>>>> word = 'tolerate'
>>>> wd_counts = Counter(word)
>>>> for char, cnt in letter_counts.items():
>       print (cnt == wd_counts[char])
>
>       
> True
> True
>>>> word = 'auto'
>>>> wd_counts = Counter(word)
>>>> for char, cnt in letter_counts.items():
>       print (cnt == wd_counts[char])
>
>       
> True
> False
>>>>
>
> or, equivalent to the above loop, but breaking when the first False is
> generated and returning the single Boolean that you're after,
>
>>>> all(cnt == wd_counts[char] for char, cnt in letter_counts.items())
> False
>>>>
>
> There's still a lot of scope for improvement, but possibly not by doing
> simple things


lol

I'm thinking about it for a couple days and you guys coming with few
ideas to it like it's nothing.
Pity I've wasted a decade with woman, now probably to old to learn
anything new.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to