Python Forum
How to calculate compounded profits on a given day?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to calculate compounded profits on a given day?
#7
Here is a little something I got going. I could finish the code for you, but I figure it isn't learning if it's all the way done ;)

def compound_investment():

    try:
        i = input("[Investment Amount]: $")

        if not i.isnumeric():
            raise TypeError

        else:
            print(int(i))

    except TypeError:
        print("[TypeError]: Please enter numerical values only!\n\n")
        compound_investment()

compound_investment()

print("Investment Float: {}{:.2f}".format( "$", int(2) ))

Here is a little something I got going. I could finish the code for you, but I figure it isn't learning if it's all the way done ;)

def compound_investment():

    try:
        i = input("[Investment Amount]: $")

        if not i.isnumeric():
            raise TypeError

        else:
            print(float(i))

    except TypeError:
        print("[TypeError]: Please enter numerical values only!\n\n")
        compound_investment()

compound_investment()

print("Investment Float: {}{:.2f}".format( "$", float(2) ))
You may want to consider adding some of your own variables to determine how many years they are employed. You also want to include a formula in the function that calculates your compounded interest. One way would be compounded_interest = float(investment*0.2)+investment
compounded_interest * years = sum

That will help you get to where you need to go. There are other ways you can futher this program by adding in features that could import your spreadsheets and take in the data for you. However, that is a little bit beyond me and I am still learning as well.
Reply


Messages In This Thread
RE: How to calculate compounded profits on a given day? - by Donovan - Aug-08-2020, 09:05 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020