You are viewing a single comment's thread from:
RE: Part 9: How To Calculate A Post's Total Rewards Using Steem-Python
Probably silly question, from someone new to Python, how come we can't use the same code for 'recent_claims' that we used for 'reward_balance' - code in second line:
It's because
Amount
is a class insteem-python
that splits a string like "10 SBD" intoamount
(10) andasset
(SBD) as you can see here. Thefloat()
function just converts a number or a string into a float! If you really wanted you could dorecent_claims = float(reward_fund["reward_balance"].split()[0])
instead, but it's easier to just useAmount
class.I see, thank you!
This example here shows better what is going on, nice, now I have two options!
There are no silly questions! I will let @amosbastian tackle this one though as he wrote this tutorial