Skip to content

Instantly share code, notes, and snippets.

@canerbasaran
Last active November 19, 2022 09:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save canerbasaran/6334104 to your computer and use it in GitHub Desktop.
Save canerbasaran/6334104 to your computer and use it in GitHub Desktop.
Rastgele TC Kimlik No Üreticisi
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011 Caner BASARAN
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
from random import randint
def rastgele_tc():
tcno = str(randint(100000000, 1000000000))
list_tc = map(int, tcno)
tc10 = (sum(list_tc[::2]) * 7 - sum(list_tc[1::2])) % 10
return tcno + str(tc10) + str((sum(list_tc[:9]) + tc10) % 10)
@canerbasaran
Copy link
Author

@kankayaibrahim
Copy link

merhaba,
13. satırı
list_tc = list(map(int, tcno))
olarak değiştirmek gerekiyor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment