-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Palindrome function with standard main function.
- Loading branch information
1 parent
4578208
commit fa5948f
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
def es_palindromo(frase): | ||
# Pasamos a minusculas y sacamos los espacios | ||
frase = frase.lower().replace(" ","") | ||
# Comparamos si la frase conincide con su inversa | ||
return frase == frase[::-1] | ||
|
||
def run(): | ||
# Leemos la frase | ||
frase = input("Ingrese una frase: ") | ||
# Analizamos si la frases es igual a su inversa | ||
if es_palindromo(frase): | ||
print("Es palíndromo") | ||
else: | ||
print("No es palíndromo") | ||
|
||
if __name__ == "__main__": | ||
run() |