Guest User

Untitled

a guest
Feb 18th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import csv
  4. import math
  5.  
  6. list_tc = [None]*75
  7. list_adsoyad = [None]*75
  8.  
  9. def hash_chain():
  10. def hash(tc):
  11. tc = int(tc)
  12. k = int(math.sqrt(tc)**3+math.sqrt(tc)*2)
  13. return k%75
  14.  
  15.  
  16. oku = open("ogrenci10.csv", "r")
  17. kisiler = oku.readlines()
  18.  
  19. for kisi in kisiler:
  20.  
  21. ad = kisi.split(';')[1]
  22. soyad = kisi.split(';')[2]
  23. tc = kisi.split(';')[3]
  24. tc = tc[:len(tc)-1]
  25.  
  26. adsoyad = ad[:len(ad)-1] + " " + soyad[1:]
  27.  
  28. indis = hash(tc)
  29.  
  30. if list_tc[indis] == None :
  31.  
  32. list_tc[indis] = tc
  33. list_adsoyad[indis] = adsoyad
  34. else :
  35.  
  36. if len(list_tc[indis]) == 11 :
  37. gecici = list_tc[indis]
  38. gecici2 = list_adsoyad[indis]
  39. list_tc[indis] = [gecici]
  40. list_adsoyad[indis] = [gecici2]
  41. list_tc[indis].append(tc)
  42. list_adsoyad[indis].append(adsoyad)
  43.  
  44. else :
  45. list_tc[indis].append(tc)
  46. list_adsoyad[indis].append(adsoyad)
  47.  
  48. print list_adsoyad
  49. print list_tc
  50.  
  51.  
  52. def hash_name(tc):
  53. index = hash(tc)
  54. if len(list_tc[index]) == 11:
  55. print list_adsoyad[index]
  56.  
  57. else:
  58. i = list_tc[index].index(tc)
  59. print list_adsoyad[index][i]
  60.  
  61. hash_chain()
  62. hash_name('66808095204')
Add Comment
Please, Sign In to add comment