Last active
August 29, 2015 14:07
-
-
Save dangayle/6d9edededc9459a38d3a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
I need to create a "most active" or "hottest" stories list, the main variables | |
being number of comments, number of views, and pubdate. | |
How do I take the three variables and create sort of weighted score, then sort on the score? | |
""" | |
stories = [ | |
{ # 2 days old | |
"id": 1, | |
"num_comments": 12, | |
"num_views": 3000, | |
"pubdate": datetime.datetime(2014, 10, 6, 6, 0, 0, 0) | |
}, | |
{ # high comments | |
"id": 2, | |
"num_comments": 201, | |
"num_views": 600, | |
"pubdate": datetime.datetime(2014, 10, 8, 6, 0, 0, 0) | |
}, | |
{ # a few hours/minutes old, but high views | |
"id": 3, | |
"num_comments": 1, | |
"num_views": 1300, | |
"pubdate": datetime.datetime(2014, 10, 6, 13, 43, 42, 859814) | |
} | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment