Must not be reading the docs well enough. I have never used
sorted() on a string, which explains my structured approach, earlier. Oddly enough, I never thought of comparing lists, either. (shakes head)
>>> sorted("bhgjtidkwl") ['b', 'd', 'g', 'h', 'i', 'j', 'k', 'l', 't', 'w'] >>> sorted("bhgjtidkwl") == sorted("bhgjtidkwl") True >>>
An obvious improvement, given this tiny bit of wherewithal. Kudos!
return 1 if a == b else 0
would round out this one. Simple variables used for brevity in example.