Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- import csv
- import math
- list_tc = [None]*75
- list_adsoyad = [None]*75
- def hash(tc):
- tc = int(tc)
- k = int(math.sqrt(tc)**3+math.sqrt(tc)*2)
- return k%75
- def hash_chain():
- oku = open("ogrenci10.csv", "r")
- kisiler = oku.readlines()
- for kisi in kisiler:
- ad = kisi.split(';')[1]
- soyad = kisi.split(';')[2]
- tc = kisi.split(';')[3]
- tc = tc[:len(tc)-1]
- adsoyad = ad[:len(ad)-1] + " " + soyad[1:]
- indis = hash(tc)
- if list_tc[indis] == None :
- list_tc[indis] = tc
- list_adsoyad[indis] = adsoyad
- else :
- if len(list_tc[indis]) == 11 :
- gecici = list_tc[indis]
- gecici2 = list_adsoyad[indis]
- list_tc[indis] = [gecici]
- list_adsoyad[indis] = [gecici2]
- list_tc[indis].append(tc)
- list_adsoyad[indis].append(adsoyad)
- else :
- list_tc[indis].append(tc)
- list_adsoyad[indis].append(adsoyad)
- print list_adsoyad
- print list_tc
- def hash_name(tc):
- index = hash(tc)
- if len(list_tc[index]) == 11:
- print list_adsoyad[index]
- else:
- i = list_tc[index].index(tc)
- print list_adsoyad[index][i]
- hash_chain()
- hash_name('66808095204')
Add Comment
Please, Sign In to add comment