Write a program to reverse a string
#Simple trick to reverse a string
str = "debug" #declare string
revstr = str[::-1]
print("Reversed string is ", revstr)
#Now check if str is palindromic
#words which remain the same when spelt backwards are called palindromes
#E.g. madam, noon, radar, refer, stats
if str == revstr:
print(str, " is a palindrome")
else:
print(str, " is not a palindrome")
#EndOfProgram
Advertisements