English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
주어진 문자열이 회문인지 확인하는 작업을 수행해야 합니다.
: Step1: 문자열을 입력으로 입력하세요. : Step2: 문자열 슬라이싱을 사용하여 문자열을 뒤집고 원래 문자열과 비교합니다. : 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