Created
January 29, 2019 01:58
-
-
Save junhoyeo/bdd286cbacd0737b307e0297c98aad35 to your computer and use it in GitHub Desktop.
주민등록번호 검산에 사용할 수 있는 함수
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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