<center>https://cdn.discordapp.com/attachments/404587860872921088/405329216280723458/challenge.png</center> For each tutorial we release there will be a relevant challenge where the winner receives 1 STEEM! ### Challenge Take the code from the tutorial from [here](https://github.com/amosbastian/steempy-tutorials/tree/master/part_19) and change it to be able to do the following 1. Counting blocks is perfect for multi threading as each blocks does not effect another block. Alter the code in such a way that is takes `amount_of_threads` as a second command line argument and equally divides the blocks to be analysed among these threads. Combine the collected data and the end. That's it! Good luck to everyone participating! ### Deadline The prize money will be rewarded to the person that solves the problem first. If there is no solution within 7 days after this post has been submitted the prize pool expires. ### Relevant Tutorial(s) - [Part 19: Analysing The Steem Blockchain From A Custom Block Number For A Custom Block Count](https://steemit.com/utopian-io/@steempytutorials/part-19-analysing-the-steem-blockchain-for-a-custom-block-number-for-a-custom-block-count) --- If you have questions about the tutorial or the challenge then don't hesitate to comment below or contact us on [Discord](https://discord.gg/rYTV87W)!
author | steempytutorials |
---|---|
permlink | daily-steem-python-challenge-19-win-1-steem |
category | programming |
json_metadata | {"tags":["programming","python","contest","bot","steemdev"],"image":["https://cdn.discordapp.com/attachments/404587860872921088/405329216280723458/challenge.png"],"links":["https://github.com/amosbastian/steempy-tutorials/tree/master/part_19","https://steemit.com/utopian-io/@steempytutorials/part-19-analysing-the-steem-blockchain-for-a-custom-block-number-for-a-custom-block-count","https://discord.gg/rYTV87W"],"app":"steemit/0.1","format":"markdown"} |
created | 2018-01-31 15:05:27 |
last_update | 2018-01-31 15:10:51 |
depth | 0 |
children | 3 |
last_payout | 2018-02-07 15:05:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 2.339 HBD |
curator_payout_value | 0.032 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,342 |
author_reputation | 31,094,047,689,691 |
root_title | "Daily Steem-Python Challenge #19, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 33,879,996 |
net_rshares | 379,560,787,460 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
juliank | 0 | 342,264,928,015 | 30% | ||
makerhacks | 0 | 10,923,859,378 | 100% | ||
regorov | 0 | 55,115,916 | 100% | ||
iqbaladan | 0 | 607,087,302 | 25% | ||
amosbastian | 0 | 15,059,219,954 | 100% | ||
veenox | 0 | 186,023,895 | 100% | ||
oups | 0 | 2,917,843,267 | 100% | ||
fisherck | 0 | 1,456,583,752 | 100% | ||
steempytutorials | 0 | 3,977,451,744 | 100% | ||
criptoivan-en | 0 | 399,741,987 | 100% | ||
luj1 | 0 | 506,163,244 | 100% | ||
bruce-forks | 0 | 613,807,558 | 100% | ||
pritpatel | 0 | 592,961,448 | 100% | ||
musafir79 | 0 | 0 | 100% | ||
kabirlec9 | 0 | 0 | 100% | ||
prasannab | 0 | 0 | 100% |
[Here's](https://gist.github.com/bruce-forks/51d24ddaddaca7465302e0b77f006857) my solution. Hope you like it!
author | bruce-forks |
---|---|
permlink | re-steempytutorials-daily-steem-python-challenge-19-win-1-steem-20180201t054041432z |
category | programming |
json_metadata | {"tags":["programming"],"links":["https://gist.github.com/bruce-forks/51d24ddaddaca7465302e0b77f006857"],"app":"steemit/0.1"} |
created | 2018-02-01 05:40:39 |
last_update | 2018-02-01 05:40:39 |
depth | 1 |
children | 2 |
last_payout | 2018-02-08 05:40:39 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.052 HBD |
curator_payout_value | 0.014 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 109 |
author_reputation | 534,201,026,995 |
root_title | "Daily Steem-Python Challenge #19, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 34,045,243 |
net_rshares | 11,415,530,758 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
juliank | 0 | 11,415,530,758 | 1% |
Nice work! I will send you the prize money. Question: You create a separate dict for each thread: `results.append({})` And you also lock this dict for every write: ``` lock.acquire() if operation not in self.stats: self.stats[operation] = 1 else: self.stats[operation] += 1 lock.release() ``` Is this required since the dict is still part of the results list? I do not know, so this is a genuine question. My solution is a bit different in that regard and also yields faster times, I will be submitting a tutorial soon.
author | juliank |
---|---|
permlink | re-bruce-forks-re-steempytutorials-daily-steem-python-challenge-19-win-1-steem-20180202t000838091z |
category | programming |
json_metadata | {"tags":["programming"],"app":"steemit/0.1"} |
created | 2018-02-02 00:08:39 |
last_update | 2018-02-02 00:08:39 |
depth | 2 |
children | 1 |
last_payout | 2018-02-09 00:08:39 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 598 |
author_reputation | 117,823,071,447,502 |
root_title | "Daily Steem-Python Challenge #19, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 34,256,737 |
net_rshares | 613,754,140 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
bruce-forks | 0 | 613,754,140 | 100% |
Yeah, I don't think that lock is necessary. I used it because I thought since they are all part of a larger array I should use it to be safe, but I think it would be just as safe without. Nice catch!
author | bruce-forks |
---|---|
permlink | re-juliank-re-bruce-forks-re-steempytutorials-daily-steem-python-challenge-19-win-1-steem-20180203t223425340z |
category | programming |
json_metadata | {"tags":["programming"],"app":"steemit/0.1"} |
created | 2018-02-03 22:34:24 |
last_update | 2018-02-03 22:34:24 |
depth | 3 |
children | 0 |
last_payout | 2018-02-10 22:34:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 199 |
author_reputation | 534,201,026,995 |
root_title | "Daily Steem-Python Challenge #19, Win 1 Steem!" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 34,744,984 |
net_rshares | 0 |