In Python, Scramble String And Check If Two Strings Are Anagram
from random import shuffle
def scramble_letters(txt):
chars = list(txt)
shuffle(chars)
return ''.join(chars)
def is_anagram(s1, s2):
return ''.join(sorted(list(s1))) == ''.join(sorted(list(s2)))
Comments
Post a Comment