Skip to content

Instantly share code, notes, and snippets.

@esmaeelE
Created April 22, 2024 12:24
Show Gist options
  • Save esmaeelE/205dd90b71953beeac7238e9a4af84fe to your computer and use it in GitHub Desktop.
Save esmaeelE/205dd90b71953beeac7238e9a4af84fe to your computer and use it in GitHub Desktop.
capital calculation, compound interest
initial_capital=100
raised_capital=120
diff = raised_capital - initial_capital
percent = diff / 100
profit_percent=0.1
def compond_interest(present_value, profit_percent, number):
"""
"""
final_value=present_value*pow(1+profit_percent, number)
return final_value
def simple_interest(present_value, profit_percent):
"""
"""
final_value = present_value + (present_value * profit_percent)
return final_value
val_simple = simple_interest(present_value=initial_capital, profit_percent=profit_percent)
val_compond = compond_interest(initial_capital, .1, 12)
print(round(val_simple, 2))
print(round(val_compond, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment