def computeNearestNeighbor(username, users):
 distances = []
 for user in users:
  if (user != username):
   distance = manhattan(users[user], users[username])
   distances.append((distance, user))
 distances.sort()
 return distances

def computeNearestNeighbor ( username , users ) : distances = [ ] for user in users : if ( user != username ) : distance = manhattan ( users [ user ] , users [ username ] ) distances . append ( ( distance , user ) ) distances . sort ( ) return distances
creates a sorted list of users based on their distance to username .