Sorry I have a problem concerning the comment in your code:
# and then populate the lists with friendships
for i, j in friendships:
# this works because users[i] is the user whose id is i
users[i]["friends"].append(users[j]) # add i as a friend of j
users[j]["friends"].append(users[i]) # add j as a friend of i
to be specific,users[i]["friends"].append(users[j]) # add i as a friend of j add i as a friend of j should be changed into " add j as a friend of i" right?
Sorry I have a problem concerning the comment in your code:
to be specific,
users[i]["friends"].append(users[j]) # add i as a friend of j
add i as a friend of j should be changed into " add j as a friend of i" right?Because
So we can no we add
users[j]
intousers[i]["friends"]
right?