So I've been trying this for a while now but just can't get it work. If you look in the picture you see 2 people in the x and y axes and both are the ratings they gave to movies. And the question is how can I calculate the manhattan distance between these to people.

so this is what I already have... edit i forgot to say that prefs is a dict with personname as key and and a second dict as the value. second dict contains movies as key and rating as value.. and the person1 and 2 are just strings with name which can be found in prefs
def sum_manhattan(prefs,person1,person2):
"""Calculates the Manhattan distance between two critics"""
total = 0
##assume person1 is the x axes and person 2 is the y axes
x = prefs[person1]
y = prefs[person2]
for movie in x:
if movie in y:
total = abs(x[movie]-y[movie])
return total
any help is welcome :)