Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. IC = str(input("Enter the IC to be validated: "))
  2.  
  3. temp1 = int(IC[1])
  4. temp2 = int(IC[2])
  5. temp3 = int(IC[3])
  6. temp4 = int(IC[4])
  7. temp5 = int(IC[5])
  8. temp6 = int(IC[6])
  9. temp7 = int(IC[7])
  10.  
  11. a = temp1 * 2
  12. b = temp2 * 7
  13. c = temp3 * 6
  14. d = temp4 * 5
  15. e = temp5 * 4
  16. f = temp6 * 3
  17. g = temp7 * 2
  18.  
  19. total_of_multiplication = int(a + b + c + d + e + f + g)
  20.  
  21. total_add4 = int(total_of_multiplication + 4)
  22.  
  23. remainder = int(total_add4 % 11)
  24.  
  25. index = remainder.replace(0,"J").replace("1","Z").replace("2","I").replace("3","H").replace("4","G").replace("5","F").replace("6","E").replace("7","D")
  26. index2 = index.replace("8","C").replace("9","B").replace("10","A")
  27.  
  28. lastletterofIC = str(IC[8])
  29.  
  30. if index2 == lastletterofIC:
  31.     print("Validity of the IC: True")
  32. else:
  33.     print("False")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement