📜  Python - Cómo comprobar si dos cuerdas son anagramas - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:17.537000             🧑  作者: Mango

代码示例1
def check_anagram(a, b):     if a is None or b is None or len(a) != len(b):         return "Not Anagram"              return "Anagram" if sorted(a) == sorted(b) else "Not Anagram"  print(check_anagram("keen", "knee")) print(check_anagram("race", "care")) print(check_anagram("fried", "fired")) print(check_anagram("apple", "paddle")) print(check_anagram("first", "second")) print(check_anagram(None, "second")) print(check_anagram("first", None)) print(check_anagram(None, None))