From 73d0deef8bad64e542f73982789bebeb50e347a4 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sun, 23 Jul 2017 19:59:49 +0200 Subject: clear --- python/palindroma.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'python/palindroma.py') diff --git a/python/palindroma.py b/python/palindroma.py index af82a04..6c3a7e9 100644 --- a/python/palindroma.py +++ b/python/palindroma.py @@ -1,15 +1,22 @@ -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 +# 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') +parola = raw_input('Parola: ') -parola = input('Parola: ') - -if palindromo(parola, 0, len(parola)-1): +if parola == parola[::-1]: print('Palindroma') else: - print('Non palindroma') + print('Non palindroma') \ No newline at end of file -- cgit v1.2.3-18-g5258