forked from zezecodes/CompoundInterestProgram
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompoundInterest.py
More file actions
33 lines (21 loc) · 1.27 KB
/
CompoundInterest.py
File metadata and controls
33 lines (21 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
print("Welcome to the Zeze investment portal!")
print("Please input the info required to begin the process")
age = int(input("How old are you? - "))
print(age)
income = int(input("How much are you paid in GHS? - "))
#The issue in your code is in the way you are handling the income input. The print() function is used when displaying output,
# but it does not convert the input to an integer.
# Additionally, you are trying to convert the result of print(income) to an integer, which won't work as print() returns None.
#incomeVal = int(print(income)) this is your code and it has been changed to the code on the next line
incomeVal = (income)
principal = int(input("How much are you willing to invest?(Investments start from GHS100 and above) - "))
#the print function has been cleared principalVal = print(principal)
time = int(input('How long do you want to invest?(In years) - '))
#the print function has been cleared #timeVal =print(time)
timeVal = (time)
print('Interest rate is 16% per annum')
interestRate = (0.16)
#finalAmount = (principalVal * (1 + (interestRate)) ^ (time)) the code has been corrected below
finalAmount = ((principal) * (1 + interestRate)**(time))
print(finalAmount)
print(f"The amount you will be making at the end of the time period is {finalAmount}")