# 回文数 121 是; 123 不是 #定义一个函数 判断是否是回文数 def get_Hui(num): #将整数num转字符串 str_num = str(num) str_num_change = str_num[::-1] num2 = int(str_num_change) #判断整数num和num2是否相等 if(num2 == num): print("是回文数") return True else: print("不是回文数") return False print(get_Hui(123))
标签:cn,https,num2,num,str,print,leetcode,回文 From: https://www.cnblogs.com/haha1988/p/17515235.html