Skip to content

Turning in Mini Project#11

Open
rwong3 wants to merge 1 commit intosd16fall:masterfrom
rwong3:master
Open

Turning in Mini Project#11
rwong3 wants to merge 1 commit intosd16fall:masterfrom
rwong3:master

Conversation

@rwong3
Copy link

@rwong3 rwong3 commented Oct 3, 2016

No description provided.

Copy link

@runnersaw runnersaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review is intended to help you with writing readable and understandable code, not to evaluate or improve the functionality of your code.

I have only three small comments to make:

  1. You can move the declaration of the Rembrandt and Michealangelo variables to right before you call counting on them, such as:
Michaelangelo=URL("http://www.gutenberg.org/cache/epub/11242/pg11242.txt").download()
counting(Michaelangelo)

This improves the readability of your code by grouping related and sequential tasks.
2. dic [morepureword] should be dic[morepureword]. It's best practice to not put a space when getting a value from a dictionary
3. Printing hundreds of things generally makes it hard for a reader to see what is going on. Decide how many results a user would care about, and only print that many words.
4. Improve the naming of your function and arguments. print_words_by_frequency would be a better name than counting because a reader can immediately tell what is going to happen when it is called. Naming the argument better would also be helpful. In addition, providing a comment at the beginning of each function is recommended, like the following:

def double(x):
    '''
    This function returns x * 2
    '''

Overall, the code was very concise and pretty readable.

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.

2 participants