You should either make distance into array or merge two loops. Because currently you always use the last value of distance calculated in the first pair of for loops.
So you code can be modified for example in the following way:
distance=[[calculate_distance(boids[i],boids[j]) for j in range(len(boids))] for i in range(len(boids))]
for element_1 in range(len(boids)):
for element_2 in range(len(boids)):
if element_1 != element_2: # for diferent boids
if distance[element_1][element_2] <= 50: # with a distance of <=50
neighbors += 1
print distance[element_1][element_2]
You can as well just do all the neighbor calculations in the first loop:
neighbors =0
for element_1 in range(len(boids)):
for element_2 in range(len(boids)):
if element_1 != element_2: # for two different boids:
distance = calculate_distance(boids[element_1],boids[element_2])
if distance <=50:
neighbors += 1