Created
May 31, 2017 14:43
-
-
Save tiagocordeiro/393159b54d296d25871f3d278d63452d to your computer and use it in GitHub Desktop.
Pypratico Exercício Anagrama
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def eh_anagrama(str1, str2): | |
str1 = str1.lower().replace(" ", "") | |
str2 = str2.lower().replace(" ", "") | |
anagrama = sorted(str1) == sorted(str2) | |
return anagrama | |
if __name__ == '__main__': | |
print(eh_anagrama('ABA', 'AaB')) | |
print(eh_anagrama('THE ALIAS MEN', 'ALAN SMITHEE')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from exercicios.anagrama_tiago import eh_anagrama | |
def test_eh_anagrama_tiago(): | |
assert eh_anagrama('ABA', 'BAA') | |
assert eh_anagrama('THE ALIAS MEN', 'ALAN SMITHEE') | |
def test_eh_anagrama_tiago_falso(): | |
assert not eh_anagrama('ABA', 'ACA') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment