Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- isikukood = input()
- count = 0
- for i in isikukood:
- if i in '0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15':
- count = count + 1
- kood1 = int(isikukood[0])
- try:
- kood2 = int(isikukood[1])
- except IndexError:
- pass
- try:
- kood3 = int(isikukood[2])
- except IndexError:
- pass
- try:
- kood4 = int(isikukood[3])
- except IndexError:
- pass
- try:
- kood5 = int(isikukood[4])
- except IndexError:
- pass
- try:
- kood6 = int(isikukood[5])
- except IndexError:
- pass
- try:
- kood7 = int(isikukood[6])
- except IndexError:
- pass
- try:
- kood8 = int(isikukood[7])
- except IndexError:
- pass
- try:
- kood9 = int(isikukood[8])
- except IndexError:
- pass
- try:
- kood10 = int(isikukood[9])
- except IndexError:
- pass
- try:
- kood11 = int(isikukood[10])
- except IndexError:
- pass
- try:
- supleks = kood1 * 1 + kood2 * 2 + kood3 * 3 + kood4 * 4 + kood5 * 5 + kood6 * 6 + kood7 * 7 + kood8 * 8 + kood9 * 9 + kood10 * 1
- except NameError:
- pass
- try:
- supleks2 = supleks % 11
- except IndentationError and NameError:
- pass
- try:
- supleks3 = supleks % 11 - 4
- except IndentationError and NameError:
- pass
- koer0 = isikukood[0] <= str(6)
- try:
- koer1 = isikukood[3] <= str(1)
- except IndexError and IndentationError and IndexError:
- pass
- try:
- koer2 = isikukood[5] <= str(3)
- except IndexError:
- pass
- try:
- koer3 = int(isikukood[10]) == supleks2
- except IndexError:
- pass
- try:
- koer4 = int(isikukood[10]) == supleks2 - 1
- except IndexError:
- pass
- try:
- koer5 = int(isikukood[10]) == supleks3
- except IndexError:
- pass
- if count == 11 and koer3 and koer2 and koer1 and koer0:
- print ("on Eesti isikukood")
- elif count == 11 and koer4 and koer2 and koer1 and koer0:
- print ("on Eesti isikukood")
- elif count == 11 and koer5 and koer2 and koer1 and koer0:
- print ("on Eesti isikukood")
- else:
- print ("ei ole Eesti isikukood")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement