diff options
-rw-r--r-- | python/palindroma.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/python/palindroma.py b/python/palindroma.py new file mode 100644 index 0000000..af82a04 --- /dev/null +++ b/python/palindroma.py @@ -0,0 +1,15 @@ +def palindromo(parola, start, end): + if start >= end: + return True + elif parola[start] == parola[end]: + return palindromo(parola, start+1 , end-1) + else: + return False + + +parola = input('Parola: ') + +if palindromo(parola, 0, len(parola)-1): + print('Palindroma') +else: + print('Non palindroma') |