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 is solving the actual problem ;)

The OP isn't looking for anagrams, he wants to know if string2 can be spelt 
with the characters in string1:

abba, abbbbbacus --> True (don't care about the extra b, c, u, s)
abba, baab --> True (don't care about character order)
abba, bab --> False (bab is missing an a)


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to