rudydu @ 2022-07-27 20:43:21
a,b,c,d = input().split("-")
if d == "X":
d = "10"
isbn = a + b + c
total = 0
for i in range(9):
total += (i+1)*int(isbn[i])
if d == str(total%11):
print("Right")
elif total%11 == 10:
d = "X"
print(a + "-" + b + "-" + c + "-" + d)
else:
print(a + "-" + b + "-" + c + "-" + str(total%11))
为什么第四个点就是不过啊,他说应该是Right,但我本地跑的就是Right啊 为什么啊八嘎
by rudydu @ 2022-07-27 20:43:34
同问
by rudydu @ 2022-07-27 20:43:43
+1
by c_cpp_a @ 2022-07-27 21:00:29
@rudydu 要弄清楚python的版本号,不同的版本兼容性有些问题
by c_cpp_a @ 2022-07-27 21:02:02
问一下本地的python版本?评测的时候的python版本?
by c_cpp_a @ 2022-07-27 21:03:56
如果是Pypy2或python2的话这道题这个做法确实有些问题
by rudydu @ 2022-07-27 22:04:15
@c_cpp_a
都是python3