求助python大佬,5A 5RE
查看原帖
求助python大佬,5A 5RE
329854
Harmony_Lu楼主2020/6/30 20:41

之前也碰到过几次RE,一直弄不明白RE到底是怎么回事???艰难刷题的python萌新 求助!!

n = input()
l = []
i = 0
j = 0
code = 0
while i<len(n)-1:
    if n[i]=='-':
        i += 1
        continue
    else:
        l.append(int(n[i]))
        code += (j+1) * l[j]
        i += 1
        j += 1

code = code%11
if code==10:
    if n[-1]=='X':
        print("Right")
    else:
        print(n[:-1]+'X')
else:
    if int(n[-1])==code:
        print("Right")
    else:
        print(n[:-1]+str(code))
2020/6/30 20:41
加载中...