Python Forum
Program calculating intrests
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Program calculating intrests
#1
def money():
    capital = int(input('Input amount of money invested: '))
    percentage = float(input('Input percentage provided by bank: '))
    days = int(input('Input amount of days, 30 - month, 360 - year: '))
    capitalisation = int(input('Capital is capitalised how many times?: '))
    i = 0
    while i < capitalisation:
        profit = (capital * percentage * days/capitalisation)/36000
        capital = capital + profit
        i += 1
    print("You will have:", capital)
    again()
def again():
    calc_again = input('''Do you want to calculate again? Please type Y for YES or N for NO: ''')
    if calc_again.upper() == 'Y':
        money()
    elif calc_again.upper() == 'N':
        print('Thanks for launching.')
    else:
        print('Enter a valid answer')
        again()
money()
That's my code. If you assume that the percentage given by the bank is capitalised once a year it works fine, but if i try to capitalise it more often, it all goes wrong.  Did I mistake anything in code or i just went wrong way developing my idea? I'm new to programming and seeking for simple explanation. Thanks in advance!
Reply
#2
(Jan-03-2017, 04:43 PM)the_werid_guy Wrote: it all goes wrong
That's not really a good description of the problem.
Give us more details. Do you get an error (what is it)? Do you get wrong result (what did you get and what did you expect)?
Reply


Forum Jump:

User Panel Messages

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