Discuss / Python / 交作业

交作业

Topic source

叫__啥

#1 Created at ... [Delete] [Delete and Lock User]
在此插入代码

def is_palindrome(n): def char2num(c): return {'0':0, '1':1, '2':2, '3':3, '4':4, '5':5, '6':6, '7':7, '8':8, '9':9}[c] s = str(n) L1 = list(map(char2num,s)) L2 = [] for i in range(1,len(s)+1): L2.append(L1[-i]) return L2 == L1


  • 1

Reply