Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. isikukood = input()
  2. count = 0
  3. for i in isikukood:
  4. if i in '0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15':
  5. count = count + 1
  6.  
  7. kood1 = int(isikukood[0])
  8. try:
  9. kood2 = int(isikukood[1])
  10. except IndexError:
  11. pass
  12. try:
  13. kood3 = int(isikukood[2])
  14. except IndexError:
  15. pass
  16. try:
  17. kood4 = int(isikukood[3])
  18. except IndexError:
  19. pass
  20. try:
  21. kood5 = int(isikukood[4])
  22. except IndexError:
  23. pass
  24. try:
  25. kood6 = int(isikukood[5])
  26. except IndexError:
  27. pass
  28. try:
  29. kood7 = int(isikukood[6])
  30. except IndexError:
  31. pass
  32. try:
  33. kood8 = int(isikukood[7])
  34. except IndexError:
  35. pass
  36. try:
  37. kood9 = int(isikukood[8])
  38. except IndexError:
  39. pass
  40. try:
  41. kood10 = int(isikukood[9])
  42. except IndexError:
  43. pass
  44. try:
  45. kood11 = int(isikukood[10])
  46. except IndexError:
  47. pass
  48.  
  49. try:
  50. supleks = kood1 * 1 + kood2 * 2 + kood3 * 3 + kood4 * 4 + kood5 * 5 + kood6 * 6 + kood7 * 7 + kood8 * 8 + kood9 * 9 + kood10 * 1
  51. except NameError:
  52. pass
  53.  
  54. try:
  55. supleks2 = supleks % 11
  56. except IndentationError and NameError:
  57. pass
  58.  
  59. try:
  60. supleks3 = supleks % 11 - 4
  61. except IndentationError and NameError:
  62. pass
  63.  
  64. koer0 = isikukood[0] <= str(6)
  65.  
  66. try:
  67. koer1 = isikukood[3] <= str(1)
  68. except IndexError and IndentationError and IndexError:
  69. pass
  70.  
  71. try:
  72. koer2 = isikukood[5] <= str(3)
  73. except IndexError:
  74. pass
  75. try:
  76. koer3 = int(isikukood[10]) == supleks2
  77. except IndexError:
  78. pass
  79. try:
  80. koer4 = int(isikukood[10]) == supleks2 - 1
  81. except IndexError:
  82. pass
  83. try:
  84. koer5 = int(isikukood[10]) == supleks3
  85. except IndexError:
  86. pass
  87.  
  88. if count == 11 and koer3 and koer2 and koer1 and koer0:
  89. print ("on Eesti isikukood")
  90. elif count == 11 and koer4 and koer2 and koer1 and koer0:
  91. print ("on Eesti isikukood")
  92. elif count == 11 and koer5 and koer2 and koer1 and koer0:
  93. print ("on Eesti isikukood")
  94. else:
  95. print ("ei ole Eesti isikukood")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement