-
Notifications
You must be signed in to change notification settings - Fork 90
Expand file tree
/
Copy pathmain.py
More file actions
48 lines (37 loc) · 1 KB
/
main.py
File metadata and controls
48 lines (37 loc) · 1 KB
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
46
47
48
# 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):
letter = ''.join(palindrome).replace(' ','').lower() #
reverse_letter = ''.join(palindrome[::-1]).replace(' ', '').lower()
if letter == reverse_letter:
# print('ifpalabra: ', letter)
# print('ifReversa: ', reverse_letter)
return True
else:
# print('elsepalabra: ', letter)
# print('elseReversa: ', reverse_letter)
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()