Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. pesel = input("Podaj Pesel: ")
  2. if len(pesel) != 11:
  3.     print("BLAD")
  4. else:
  5.     suma = (int(pesel[0])*9
  6.             +int(pesel[1])*7
  7.             + int(pesel[2])*3
  8.             + int(pesel[3])*1
  9.             + int(pesel[4])*9
  10.             + int(pesel[5])*7
  11.             + int(pesel[6])*3
  12.             + int(pesel[7])*1
  13.             + int(pesel[8])*9
  14.             + int(pesel[9])*7)
  15.  
  16.     r = int(pesel[0:2])
  17.     m = int(pesel[2:4])
  18.     d = int(pesel[4:6])
  19.     print("miesiac przed:", m)
  20.     if int(pesel[-1]) == suma%10:
  21.         if int(pesel[9])%2==0:
  22.             plec = "K"
  23.         else:
  24.             plec = "M"
  25.             # print ("{}-{}-22{} {}" .format(pesel[4:6],int(pesel[2:4])-60,r,plec))
  26.             #69 90 21 37678 - 21 / 10 / 1869  - 150 lat - 69902137678 , 96120365873 - nie dziala, , 07311187358
  27.             # 01511315872 - 2101
  28.  
  29.         if m <= 12:
  30.             r = 1900 + r
  31.  
  32.         elif m <= 32 and m >= 20:
  33.             r = 2000 + r
  34.             m = m - 20
  35.  
  36.         elif m <= 92 and m >= 80:
  37.             r = 1800 + r
  38.             m = m - 80
  39.  
  40.         elif m <= 72 and m >= 60:
  41.             r = 2200 + r
  42.             m = m - 60
  43.  
  44.         elif m <= 52 and m >= 40:
  45.             r = 2100 + r
  46.             m = m - 40
  47.  
  48.         print(f"{d:02d}-{m:02d}-{r} {plec}")
  49.         print("Miesiac po: ", m)
  50.     else:
  51.         print('BLAD')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement