Write code to check a String is palindrome or not?

This progrom is created for check given word is palindrome or not?

https://javarevisited.blogspot.com/2011/06/top-programming-interview-questions.html

First question solved by using python


CODE:

a = input('Enter your Word to check: ')
n = len(a)
b = -1
new_word = ''
for i in range(n):
    new_word = new_word + a[b]
    b -= 1

if a ==  new_word:
    print('Given word is palindrome')
else:
    print('Given word is not palindrome')


----
Regards
PyKar

Comments

Popular posts from this blog

Hardy - Ramanujan Number (Magic Number) Program in Python

FLAMES CODE ON PYTHON

Count Swap for Sorting in Python