给定一个字符串,我们的任务是检查此字符串是否为回文。算法步骤 1:输入字符串。步骤 2:使用字符串切片反转字符串并将其与原始字符串进行比较。步骤 3:然后显示结果。示例代码 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