Skip to content

Instantly share code, notes, and snippets.

@Agenric
Last active June 27, 2017 02:10
Show Gist options
  • Save Agenric/936fde70dac3b913e4813c220349376d to your computer and use it in GitHub Desktop.
Save Agenric/936fde70dac3b913e4813c220349376d to your computer and use it in GitHub Desktop.
计算身份证号最后一位
# 假设身份证号为:653-129-1987-0526-7513
temp = 6*7 + 5*9 + 3*10 + 1*5 + 2*8 + 9*4 + 1*2 + 9*1 + 8*6 + 7*3 + 0*7 + 5*9 + 2*10 + 6*5 + 7*8 + 5*4 + 1*2
print 'temp = ',temp
y = temp % 11
list1 = [1,0,'x',9,8,7,6,5,4,3,2]
print 'last = ', list1[y]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment