Advertisement
AlimusSifar

Is Palindrome - Toph.co - Begginer

Mar 17th, 2020
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. A = list(input())
  2.  
  3. isPalindrome = True
  4. i=1
  5. while i <= int(len(A)/2):
  6.     if len(A)%2 == 0:
  7.         if A[i-1] != A[len(A)-i]:
  8.             isPalindrome = False
  9.             break
  10.     else:
  11.         if A[i-1] != A[len(A)-i]:
  12.             isPalindrome = False
  13.             break
  14.     i += 1
  15.  
  16. if isPalindrome:
  17.     print('Yes')
  18. else:
  19.     print('No')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement