Skip to content

Instantly share code, notes, and snippets.

@junhoyeo
Created January 29, 2019 01:58
Show Gist options
  • Select an option

  • Save junhoyeo/bdd286cbacd0737b307e0297c98aad35 to your computer and use it in GitHub Desktop.

Select an option

Save junhoyeo/bdd286cbacd0737b307e0297c98aad35 to your computer and use it in GitHub Desktop.
주민등록번호 검산에 사용할 수 있는 함수
def check_valid(_id): # id='0000000000000'
'''Validate Korean RRN via last number'''
check = 0
for i in range(8):
check += (i+2)*int(_id[i])
for i in range(8, 12):
check += (i-6)*int(_id[i])
check = (11 - (check % 11)) % 10
if check == int(_id[12]):
return True
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment