For each movie in personK.ratings.keys-- for each close_movie in neighbors[movie]---- weight_ratings[close_movie] += neighbors[movie][close_movie] * personK.ratings[movie]---- similarity_sum[close_movie] += neighbors[movie][close_movie]

For each target_movie in weight_ratings.keys-- weight_ratings[target_movie] /= similarity_sum[target_movie]