주어진 문자열에서 우리의 임무는 이 문자열이 회문인지 아닌지를 확인하는 것입니다.
알고리즘
Step1: Enter string as an input. Step2: Using string slicing we reverse the string and compare it back to the original string. Step3: Then display the result.
예시 코드
my_string=input("Enter string:")
if(my_string==my_string[::-1]):
print("The string is a palindrome")
else:
print("The string isn't a palindrome") 출력
Enter string:madam The string is a palindrome Enter string:python The string isn't a palindrome