Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def check_sum(pesel):
- weights = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3, 1]
- pesel_digits = [int(digit) for digit in pesel]
- if len(pesel_digits) != 11:
- print("Numer PESEL musi mieć dokładnie 11 cyfr.")
- return False
- calculated_sum = sum(p * w for p, w in zip(pesel_digits, weights))
- return calculated_sum % 10 == 0
- def main():
- pesel = input("Podaj numer PESEL: ")
- if check_sum(pesel):
- print("Numer PESEL jest prawidłowy.")
- else:
- print("Numer PESEL jest nieprawidłowy.")
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement