Reversing a string and checking if it's a palindrome
str='Joke'.upper()
reverse_string=""
count=len(str)
while count>0:
reverse_string+=str[count-1]
count=count-1
print(f'Reverse string is {reverse_string}')
if reverse_string==str:
print("It's a palindrome")
else:
print('not a palindrome')
Comments
Post a Comment