Skip to content

Commit

Permalink
Palindrome function with standard main function.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnzagustin committed Apr 20, 2021
1 parent 4578208 commit fa5948f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions palindromo.py
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()

0 comments on commit fa5948f

Please sign in to comment.