TIME TO CODE! #creative-sunday

avatar

Black Modern Software Programmer Logo.png

MADE WITH CANVA PRO


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?

Note: Here Attempt means every time I run the code with adding more logic to code.

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.

image.png

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.

Screenshot_2022-09-24-01-07-03-743_com.android.chrome.jpg

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.

image.png

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.

image.png


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.



0
0
0.000
30 comments
avatar

Small problem is a great way to learn!
!1UP


0
0
0.000
avatar

I will learn more. #creative-sunday is my over coming new challenges post. !PGM

0
0
0.000
avatar

Sent 0.1 PGM - 0.1 LVL- 1 STARBITS - 0.05 DEC - 15 SBT - 0.1 THG - tokens to @dlmmqb

remaining commands 3

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!

image.png
Discord image.png

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


0
0
0.000
avatar

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.

image.png

Please contribute to the community by upvoting this comment and posts made by @indiaunited.

0
0
0.000
avatar

This logical coding can only be possible with a very creative mind. You did great job here with lots of calculations 👌👍

0
0
0.000
avatar

Really, it's not that hard. !PIZZA with !PGM

0
0
0.000
avatar

Sent 0.1 PGM - 0.1 LVL- 1 STARBITS - 0.05 DEC - 15 SBT - 0.1 THG - tokens to @dlmmqb

remaining commands 2

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!

image.png
Discord image.png

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


0
0
0.000
avatar

Congratulations @dlmmqb! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You got more than 4000 replies.
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:

Balls of Steel - HiveFest⁷ Petanque Tournament Results
Support the HiveBuzz project. Vote for our proposal!
0
0
0.000
avatar
(Edited)

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.

0
0
0.000
avatar

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

0
0
0.000
avatar

Sent 0.1 PGM - 0.1 LVL- 1 STARBITS - 0.05 DEC - 15 SBT - 0.1 THG - tokens to @dlmmqb

remaining commands 1

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!

image.png
Discord image.png

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


0
0
0.000
avatar

Well I guess somethings are more understandable when you hear them on voice than when you read them yourself 😂

0
0
0.000
avatar

This was the same code I was teaching him !LOLZ

0
0
0.000
avatar
(Edited)

PIZZA!

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!

0
0
0.000
avatar

That's useful to be able to code, I think I've done something similar in Python.

0
0
0.000
avatar

Good to know this. !PIZZA

0
0
0.000
avatar

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

0
0
0.000
avatar

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

0
0
0.000
avatar

Sent 0.1 PGM - 0.1 LVL- 1 STARBITS - 0.05 DEC - 15 SBT - 0.1 THG - tokens to @dlmmqb

remaining commands 4

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!

image.png
Discord image.png

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


0
0
0.000
avatar

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!!

0
0
0.000
avatar

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.

0
0
0.000