# How to Calculate the Future Value using Python

You can use the following template in order to calculate the Future Value using Python:

```PV = Present Value
r = Interest Rate
n = Number of Periods

FV = PV*(1+r/100)**n
print (FV)
```

In the next section, I’ll review an example with the steps to calculate the future value. I’ll also share with you the code to create the following tool to derive the future value:

## Steps to Calculate the Future Value using Python

### Step 1: Gather the data

To start, gather the data for the future value calculations.

For example, I gathered the following dataset:

• Present Value (PV) = 3000
• Interest Rate in % (r) = 5
• Number of periods (n) = 9

The goal is to derive the future value based on the above data.

### Step 2: Get the Future Value using Python

You can use the following template in order to derive the future value using Python:

```PV = Present Value
r = Interest Rate
n = Number of Periods

FV = PV*(1+r/100)**n
print (FV)
```

And this is the complete code to get the future value for our example:

```PV = 3000
r = 5
n = 9

FV = PV*(1+r/100)**n
print (FV)
```

Run the code and you’ll get the future value of 4653.98:

## Get the Future Value using a Graphical User Interface

You could also build a simple graphical user interface (GUI) in order to get the future value.

To accomplish this task, you may utilize the tkinter package, which can be used to build a GUI in Python.

Here is the complete code:

```import tkinter as tk

root= tk.Tk()

canvas1 = tk.Canvas(root, width = 470, height = 480)
canvas1.pack()

label1 = tk.Label(root, text='Calculate Future Value')
label1.config(font=('helvetica', 14))
canvas1.create_window(235, 40, window=label1)

entry1 = tk.Entry (root)
canvas1.create_window(330, 100, window=entry1)

entry2 = tk.Entry (root)
canvas1.create_window(330, 140, window=entry2)

entry3 = tk.Entry (root)
canvas1.create_window(330, 180, window=entry3)

entry4 = tk.Entry (root)
canvas1.create_window(240, 380, window=entry4)

label1 = tk.Label(root, text='     Present Value (PV):')
label1.config(font=('helvetica', 10))
canvas1.create_window(160, 100, window=label1)

label2 = tk.Label(root, text='Interest Rate (r):')
label2.config(font=('helvetica', 10))
canvas1.create_window(160, 140, window=label2)

label3 = tk.Label(root, text='         Number of Periods (n):')
label3.config(font=('helvetica', 10))
canvas1.create_window(160, 180, window=label3)

def calcFV ():
PV = float(entry1.get())
r = float(entry2.get())
n = float(entry3.get())

FV = PV*(1+r/100)**n

label4 = tk.Label(root, text= FV,font=('helvetica', 10, 'bold'),bg='white')
canvas1.create_window(240, 380, window=label4)

button1 = tk.Button(text='Calculate Future Value', command=calcFV, bg='green', fg='white', font=('helvetica', 9, 'bold'))
canvas1.create_window(240, 330, window=button1)

root.mainloop()
```

Run the code in Python, and you’ll see the following display:

Enter the values in the entry boxes below:

• Present Value (PV) = 3000
• Interest Rate in % (r) = 5
• Number of periods (n) = 9

Finally, click on the green button, and you’ll the the future value of 4653.98: