Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Verify Anagrams by hypehr96
def verify_anagrams(first_word, second_word):
first_word = first_word.replace(" ", "").upper()
second_word = second_word.replace(" ", "").upper()
first_word = list(first_word)
second_word = list(second_word)
ki=0
count = 0
for i in first_word:
kj=0
for j in second_word:
if i==j:
second_word[kj]=' ';
count+=1
break
kj+=1
ki+=1
out = len(first_word)
if out==count and count==len(second_word):
return True
else:
return False
if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert isinstance(verify_anagrams("a", 'z'), bool), "Boolean!"
assert verify_anagrams("Programming", "Gram Ring Mop") == True, "Gram of code"
assert verify_anagrams("Hello", "Ole Oh") == False, "Hello! Ole Oh!"
assert verify_anagrams("Kyoto", "Tokyo") == True, "The global warming crisis of 3002"
Jan. 9, 2017