Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python - Cómo comprobar si dos cuerdas son anagramas

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))
Source by www.profesoradecodigo.com #
 
PREVIOUS NEXT
Tagged: #Python #comprobar #si #dos #cuerdas #son #anagramas
ADD COMMENT
Topic
Name
8+6 =