An example of the evaluation algorithm Keirsey uses in his book is above. We simply generate indexes that correspond to the columns seen above (answers arrive in a straight list, numbered from 1 to 70), then do the addition.

def calculate_mb(choices):The running version of this test is on appspot.

new_choices = []

for i in range(1,8):

new_choices.append([int(choices[j-1]) for j in range(i,71,7) ])

res = list("XXXX")

ei = sum(new_choices[0])

if ei < 0: res[0] = 'E'

else: res[0] = 'I'

sn = sum(new_choices[1]) + sum(new_choices[2])

if sn < 0: res[1] = 'S'

else: res[1] = 'N'

tf = sum(new_choices[3]) + sum(new_choices[4])

if tf < 0: res[2] = 'T'

else: res[2] = 'F'

jp = sum(new_choices[5]) + sum(new_choices[6])

if jp < 0: res[3] = 'J'

else: res[3] = 'P'

logging.debug(choices)

return str(''.join(res))