Skip to content

Conversation

mdusan
Copy link

@mdusan mdusan commented Apr 21, 2017

Corrected most_common_interests_with(user) method definition is exactly the same as in the book (page8).
The same result as the proposed correction would give a method which takes user_id = user["id"]argument instead of a dict type user argument. However, in that case the code that would be iterating through all the users to display the results would be less clean:

  • For user argument:
for user in users:
    print most_common_interests_with(user)
  • For user_id argument:
for user_id in range(len(users)):
    print most_common_interests_with(user_id)

Corrected `most_common_interests_with(user)` method definition is exactly the same as in the book (page8).
The same result as the proposed correction would give a method which takes `user_id = user["id"]`argument instead of a dict type `user` argument. However, in that case the code that would be iterating through all the users to display the results would be less clean than in case of `user` argument:
- For `user` argument:
```python
for user in users:
    print most_common_interests_with(user)
```
For `user_id` argument:
```python
for user_id in range(len(users)):
    print most_common_interests_with(user_id)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant