data-science-from-scratch
                                
                                
                                
                                    data-science-from-scratch copied to clipboard
                            
                            
                            
                        introduction coding for FINDING KEY CONNECTORS
Hi, Should the code: 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
be: users[i]["friends"].append(users[j]['id']) users[j]["friends"].append(users[i]['id']) otherwise the friends list fills with dicts and becomes unwieldy
thanks
andrew
Hi, I agrees with Andrew(awb25). if we want to add only id's of friends in the users[0]["friends"] list then dictionary key should be added in append statements after users[j]["id"]
But since in the next phase of the chapter, we need to find mutual friends so the nested dictionary is useful, which is produced by the given code