TIME TO CODE! #creative-sunday
What a busy week it was! Looking at antiabuse, training newbies, and doing management stuff. My brain said, bye bye see you later. I was doing simple math:
If payment is in 4 currencies, we need to divide it among a team of 5 members. At the same time, one member gets 5% more than the rest. Also, I had to calculate 25% of all 4, invest it into the employees' growth fund, and calculate the division from the 75%.
It looks hard but it was simple math. I am good with percentages and mental maths. Remember I just mentioned, "5 members and 1 get 5% more"? The answer was simple to the real-world problem that I need to solve and sleep. Since my brain left the upper apartment and my body was tired, I was enabled to calculate (19*4)+24 = 100 aka 19%+19%+19%+19%+24%= 100%.
I needed to finish my work and sleep so I went to PIZZA discord, the home of engagement! I left a trivia "If pizza slices are divided among 5 people while one person gets 5% more than the rest, what will each get?".
SlothlyD#7500 was quickly replied 19 for 4 and 24 for one. He further said, Wait did you tricked me to do your homework? I said no I am just tired and had to solve this basic maths and explained everything.
In the last Community hangout of HiveLearners, one of the members from the management was asking me questions about coding. Classes, Variables, OOP (Object Oriented Program), and much more. In parallel, I was solving the same equation with 6 members to divide the pizza slices (LOL). I realized The question changes each week as a real-world problem for me and I am a coder (I was teaching basic concepts, LOL), Why not I just code it?
Code Version 1:
num_tokens = input("type number of tokens you want:")
dict = {}
for i in range(int(num_tokens)):
token_name = input ("What is the token number "+str(i+1)+":")
amount_token = input("The amount of the token number "+str(i+1)+":")
dict[token_name]=int(amount_token)
print (dict)
Output:
Here I just stored the data. So what it only did was naming the currencies and storing the values.
Code Version 2:
num_tokens = input("type number of tokens you want:")
dict = {}
for i in range(int(num_tokens)):
token_name = input ("What is the token number "+str(i+1)+":")
amount_token = input("The amount of the token number "+str(i+1)+":")
dict[token_name]=int(amount_token)
for token in dict:
percentage = dict[token] *0.25
print ("25% of "+token+": "+str(percentage))
Output:
Here in addition to storing the data, I calculated 25% of the currencies because we need to invest 25% in the employee growth fund.
Code Version 3:
num_tokens = input("type number of tokens you want:")
dict = {}
for i in range(int(num_tokens)):
token_name = input ("What is the token number "+str(i+1)+":")
amount_token = input("The amount of the token number "+str(i+1)+":")
dict[token_name]=int(amount_token)
num_people = input("type the number of people that you want to share the rest of 75%:")
for token in dict:
percentage = dict[token] *0.25
print ("25% of "+token+": "+str(percentage))
remaining = dict[token] - percentage
each_member_receives = remaining/int(num_people)
print ("Each member will receive "+str(each_member_receives)+" of "+" token")
Output:
Here I added the logic of dividing between members.
Code Version 4:
num_tokens = input("type number of tokens you want:")
dict = {}
for i in range(int(num_tokens)):
token_name = input ("What is the token number "+str(i+1)+":")
amount_token = input("The amount of the token number "+str(i+1)+":")
dict[token_name]=int(amount_token)
num_people = input("type the number of people that you want to share the rest of 75%:")
for token in dict:
percentage = dict[token] 0.25
print ("25% of "+token+": "+str(percentage))
remaining = dict[token] - percentage
percentage_foreach_member = 0.95/int(num_people)
each_member_receives = remaining percentage_foreach_member
manager_receives = each_member_receives + 0.05 remaining
print ("The manager receives " + str((percentage_foreach_member+0.05)100)+"% of "+token+": "+str(manager_receives))
print ("Each other member will receive "+str(percentage_foreach_member*100)+"%: "+str(each_member_receives)+" of "+" token\n")
Output:
Here I added the logic that one person gets 5% more.
Conclusion:
I personally needed this special calculation and now on weekly bases, it will save time. I will use my own code weekly is a wonderful feeling.
Thanks,
Mahirabdullah, Rantree, and Slothlyd for being a part of this small journey. Now we will sail to the next adventure with a different story and crew! See you around Hive! DLMMQB, Signing off.
Small problem is a great way to learn!
!1UP
I will learn more. #creative-sunday is my over coming new challenges post. !PGM
BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!
The tokens that the command sends are: 0.1 PGM-0.1 LVL-0.1 THGAMING-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]
5000 PGM IN STAKE = 2x rewards!
Discord
Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP
Get potential votes from @ pgm-curator by paying in PGM, here is a guide
I'm a bot, if you want a hand ask @ zottone444
This post has been manually curated by @bhattg from Indiaunited community. Join us on our Discord Server.
Do you know that you can earn a passive income by delegating to @indiaunited. We share 100 % of the curation rewards with the delegators.
Here are some handy links for delegations: 100HP, 250HP, 500HP, 1000HP.
Read our latest announcement post to get more information.
Please contribute to the community by upvoting this comment and posts made by @indiaunited.
You have received a 1UP from @gwajnberg!
@bee-curator, @stem-curator, @pimp-curator, @vyb-curator, @pob-curator, @pal-curator, @fun-curator
And they will bring !PIZZA 🍕.
Learn more about our delegation service to earn daily rewards. Join the Cartel on Discord.
https://twitter.com/DLMMQB/status/1574071838119960576
The rewards earned on this comment will go directly to the people( @dlmmqb ) sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at https://hiveposh.com.
This logical coding can only be possible with a very creative mind. You did great job here with lots of calculations 👌👍
Really, it's not that hard. !PIZZA with !PGM
BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!
The tokens that the command sends are: 0.1 PGM-0.1 LVL-0.1 THGAMING-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]
5000 PGM IN STAKE = 2x rewards!
Discord
Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP
Get potential votes from @ pgm-curator by paying in PGM, here is a guide
I'm a bot, if you want a hand ask @ zottone444
Congratulations @dlmmqb! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):
Your next target is to reach 4250 replies.
You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word
STOP
Check out the last post from @hivebuzz:
Support the HiveBuzz project. Vote for our proposal!
Here's an advise my friend, next time you want to make a post like this that has the potential of making us go mad while trying to understand it, you should put a disclaimer at the top 😂.
That maths at the beginning was all I needed to know that this wasn't a post I would love to read.
When we were in the community hangout, you were listening when I was teaching mahir but now you wanna run? Looks like your sound was off?
!PIZZA with !PGM SAUCE
BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!
The tokens that the command sends are: 0.1 PGM-0.1 LVL-0.1 THGAMING-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]
5000 PGM IN STAKE = 2x rewards!
Discord
Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP
Get potential votes from @ pgm-curator by paying in PGM, here is a guide
I'm a bot, if you want a hand ask @ zottone444
Well I guess somethings are more understandable when you hear them on voice than when you read them yourself 😂
This was the same code I was teaching him !LOLZ
lolztoken.com
Because they stay out of treble.
Credit: reddit
@prayzz, I sent you an $LOLZ on behalf of @dlmmqb
Use the !LOL or !LOLZ command to share a joke and an $LOLZ
(2/2)
PIZZA Holders sent $PIZZA tips in this post's comments:
dlmmqb tipped nkemakonam89 (x1)
dlmmqb tipped prayzz (x1)
@dlmmqb(1/5) tipped @mintymile (x1)
Join us in Discord!
Are you a developer or something?
I am from software engineering background
And I wanted to be : (
good to know that.
That's useful to be able to code, I think I've done something similar in Python.
Good to know this. !PIZZA
Wow...wow...wow and cool!!
My brain too said good bye this weekend): , now its back to work though...Sunday it said good bye, I was damn tired as well and depressed...
Anyway... blues, for people who forget to do something fun in life...ha!! ha!!
Loved your problems which you have codes to solve now! Interesting
Why are you depressed? I don't have much time but I can help you out if u reach out to me. Depressed is usually caused by simpler things which demotivate us. I hope I will be able to figure that out for u and we can reduce the impact together. !PIZZA with !PGM
BUY AND STAKE THE PGM TO SEND A LOT OF TOKENS!
The tokens that the command sends are: 0.1 PGM-0.1 LVL-0.1 THGAMING-0.05 DEC-15 SBT-1 STARBITS-[0.00000001 BTC (SWAP.BTC) only if you have 2500 PGM in stake or more ]
5000 PGM IN STAKE = 2x rewards!
Discord
Support the curation account @ pgm-curator with a delegation 10 HP - 50 HP - 100 HP - 500 HP - 1000 HP
Get potential votes from @ pgm-curator by paying in PGM, here is a guide
I'm a bot, if you want a hand ask @ zottone444
Hey thanks @dimmqb... that's very nice of you to offer help even though your busy!!!
Thanks a lot...
Your writeup was fun though... i could visualize what you did for your maths stuff with the coding logic and loved the read!!
It's inspiring you help others use Hive and all.. I read about that!!
My pleasure! Consider me your brother (if u don't do massive power downs haha), and contact me any time u need help. My replies r delayed but I would be of your help or refer u to someone even better than my skillset.
Good Luck buddy, It's more like solving a mathematical problem. Waiting for your Success. Lots of Love to you 💕
Thanks for your kind words. Spreading!LUV
@dlmmqb(1/1) gave you LUV. tools | wallet | discord | community | <>< daily
HiveBuzz.me NFT for Peace