CPR Number
This commit is contained in:
14
cprnummer.py
Normal file
14
cprnummer.py
Normal file
@@ -0,0 +1,14 @@
|
||||
cpr = list(map(int, input().strip().replace("-", "")))
|
||||
valid = (
|
||||
cpr[0] * 4
|
||||
+ cpr[1] * 3
|
||||
+ cpr[2] * 2
|
||||
+ cpr[3] * 7
|
||||
+ cpr[4] * 6
|
||||
+ cpr[5] * 5
|
||||
+ cpr[6] * 4
|
||||
+ cpr[7] * 3
|
||||
+ cpr[8] * 2
|
||||
+ cpr[9] * 1
|
||||
) % 11 == 0
|
||||
print(1 if valid else 0)
|
||||
Reference in New Issue
Block a user