【python 3】大佬们,这个程序在某些情况下为什么会出错

P1055 [NOIP2008 普及组] ISBN 号码

Rentz8 @ 2021-10-04 16:41:37

kk=input() c=int(kk[0])1+int(kk[2])2+int(kk[3])3+int(kk[4])4+int(kk[6])5+int(kk[7])6+int(kk[8])7+int(kk[9])8+int(kk[10])*9 if kk[-1]=='X': a=10 else: a=int(kk[-1]) c=c % 11 kk1=kk[0:len(kk)-1] if c==a: print('Right') else: if c == 10: print(kk1,'X',sep='') else: print(kk1,str(c),sep='')


by Rentz8 @ 2021-10-04 16:42:28

kk=input()

c=int(kk[0])1+int(kk[2])2+int(kk[3])3+int(kk[4])4+int(kk[6])5+int(kk[7])6+int(kk[8])7+int(kk[9])8+int(kk[10])*9

if kk[-1]=='X': a=10

else: a=int(kk[-1])

c=c % 11

kk1=kk[0:len(kk)-1]

if c==a: print('Right') else: if c == 10: print(kk1,'X',sep='') else: print(kk1,str(c),sep='')


by B1ade_ @ 2021-10-04 16:42:55

望丰展?使Md


by zwh190 @ 2021-11-10 20:00:35

这写法 为了过而写


|