只需反转字符串并将其与原始字符串进行比较
string_to_check = input("Enter a string")if string_to_check == string_to_check[::-1]: print("This is a palindrome")else: print("This is not a palindrome")
欢迎分享,转载请注明来源:内存溢出
只需反转字符串并将其与原始字符串进行比较
string_to_check = input("Enter a string")if string_to_check == string_to_check[::-1]: print("This is a palindrome")else: print("This is not a palindrome")
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)