joelgrus / data-science-from-scratch

code for Data Science From Scratch book
MIT License
8.63k stars 4.5k forks source link

Update introduction.py #36

Open mdusan opened 7 years ago

mdusan commented 7 years ago

Updated to fully correspond to the exercises in the book with: (1) Deleted user[10] because the data about him is not provided and he's not listed in the users list in the book (page 3) (2) Appended part of the code from the book (page 5) for sorting the users from "most friends" to "least friends"

plkoehn commented 7 years ago

I am puzzled by the syntax error present in the "key=" line, line 54. As written, the code does not run (Python 3.5). The following does run, however:

tst = sorted(num_friends_by_id, key = lambda x: x[1], reverse = True)

I don't know, however, why the original version will not run.