Feedback - hacker news guided project

Hey folks!

Here’s my take on the hacker news project. I’d love some feedback on the code itself - I feel like I wasn’t always doing things the most efficiently or in the “right” way and without knowledge of industry norms I don’t have a lot to go on as far as what’s preferred.

The annotations in place are mostly for my benefit when looking back over the project -
don’t judge my writing skills based on those, please! i may do a fancier more portfolio-ready writeup later. Right now it’s all about the code, baby!

phoebe_hacker_news.ipynb (55.3 KB)
my jupyter notebook

Click here to view the jupyter notebook file in a new tab

Welcome to DQ Community @phoebepreble

and thank you for sharing your project!

Since you have only asked for a code, try to add the time conversion code as well, instead of having a manual comment. :slight_smile:

1 Like

Hi Phoebe, I love the readability of your code. It is clean and concise. I could learn a thing or two from you. Btw, to neatly print out the list of list, you could try this:

print (*list_of_list, sep = “\n”)

The output will be one list per line.Nothing more to comment except for the :2f which doesn’t work. Cheers.

1 Like

Hello @phoebepreble, thanks for sharing your project.

I noticed that in the code cell In[202], you tried to convert the average comments per hour to 2 decimal places, however, the code output came out different.

Reason for this is that:
You did not include .2f in the second parenthesis in the print() function, after doing this, there is no need to define a format variable.

Your new code would then be:

print("Top 5 Hours of Ask Posts Comments")
for avg, hr in sorted_swap[:5]:
        "{}:00: {:.2f} average comments per post".format(hr, avg)


Try not to define a variable name with a python Keyword as you have done in In[202] by defining the string variable with the word format.

Happy learning!