def solution(num: int) → bool:
length = len(str(num))
for i in range(length):
for j in range(length - i):
ele = str(num)[j:j + i + 1]
if len(ele) <= 1:
print(f"个位数字{str(num)[j:j + i + 1]}不被视为回文数字。")
elif ele == ele[::-1]:
return True
return False
assert solution(5) is False
assert solution(1215) is True
assert solution(1294) is False
assert solution(141221001) is True
def solution(num: int)-> bool:
# your code here
num = str(num)
for index in range(1,len(num) - 1):
if num[index - 1] == num[index + 1]:
return True
return False
assert solution(5) is False
assert solution(1215) is True
assert solution(1294) is False
assert solution(141221001) is True
assert solution(141221001) is True
def solution(num: int)-> bool:
str_num=str(num)
for left_setp in range(len(str_num)):
for right_step in range(left_setp+1,len(str_num)):
if str_num[left_setp:right_step+1]==''.join(reversed(str_num[left_setp:right_step+1])):
return True
return False
assert solution(5) is False
assert solution(1215) is True
assert solution(1294) is False
assert solution(141221001) is True