Skip to content

Instantly share code, notes, and snippets.

@osin-vladimir
Created October 22, 2015 00:29
Show Gist options
  • Save osin-vladimir/0b70e93acb5f76ccb667 to your computer and use it in GitHub Desktop.
Save osin-vladimir/0b70e93acb5f76ccb667 to your computer and use it in GitHub Desktop.
#read from file
fname = "educated_people.txt"
with open(fname) as f:
educated_people = f.read().splitlines()
f.close
fname = "birthdate.txt"
with open(fname) as f:
birthdate = f.read().splitlines()
f.close
fname = "universities_all.txt"
with open(fname) as f:
universities_all = f.read().splitlines()
f.close
print len(educated_people)
print len(birthdate)
print len(universities_all)
import numpy as np
A = np.zeros([len(educated_people), len(educated_people)])
for i in range(len(educated_people)):
for j in range(len(educated_people)):
if abs(int(birthdate[i]) - int(birthdate[j])) < 5:
A[i,j] = 1
print A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment