string method check if two words contain the same characters python code example Example: how to tell if two numbers have the same characters python sorted(str1) == sorted(str2)