-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathmain.py
45 lines (33 loc) · 821 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Resolve the problem!!
PALINDROMES = [
'Acaso hubo buhos aca',
'A la catalana banal atacala',
'Amar da drama',
]
NOT_PALINDROMES = [
'Hola como estas',
'Platzi'
'Oscar',
]
def is_palindrome(palindrome):
one_word = palindrome.replace(" ", "")
one_word_mirror = one_word[::-1]
if one_word.lower() == one_word_mirror.lower():
return True
else:
return False
def validate():
for palindrome in PALINDROMES:
if not is_palindrome(palindrome):
return False
for not_palindrome in NOT_PALINDROMES:
if is_palindrome(not_palindrome):
return False
return True
def run():
if validate():
print('Completaste el test')
else:
print('No completaste el test')
if __name__ == '__main__':
run()