# [Tutor] function question

David Lynch davidmlynch0 at gmail.com
Sat Jan 5 11:18:04 EST 2019

```Hello,
I'm not sure if this is where I can find this sort of help but I am
struggling understanding functions. I have written a simple math code but I
feel like it could be improved if I were to use it in a function.

>From what I've read about functions I should be able to define a function
with 2 variables? And then I can add all of my code into that function by
indenting it. And then shouldn't I be able to
function(float(input("enter input: ")))
function(float(input("enter input 2: ")))
return(function)
??

Also, since it'll be in a function, when I type return(function) will it
rerun the code from the top?

David Lynch
-------------- next part --------------
print("Passive income from incentivised onboarding")
capital = float(input("Amount of capital raised: "))
amount_invested = float(input("Amount invested: "))
revenue = (capital * .75) / .2
total_royalty = (capital / 100) + 3000000
royalty_blocs_owned = amount_invested / 100
percentage_owned = royalty_blocs_owned / total_royalty
total_percent_owned = royalty_blocs_owned / total_royalty
passive_income = revenue * .1 * total_percent_owned
print("Assuming 75% of the capital raised is used for incentivised onboarding and there is no organic growth. Your passive income, by the time the onboarding funds are depleted, will be: ")
print(passive_income)
print("")
print("Passive income with estimated revenue")
capital = float(input("Amount of capital raised: "))
total_royalty = (capital / 100) + 3000000
amount_invested = float(input("Amount invested: "))
royalty_blocs_owned = amount_invested / 100
percentage_owned = royalty_blocs_owned / total_royalty
total_percent_owned = royalty_blocs_owned / total_royalty
revenue = float(input("Companies Revenue: "))
passive_income = revenue * .1 * total_percent_owned
print("Your passive income based on the revenue provided will be: ")
print(passive_income)
```