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!
Program calculating intrests
Users browsing this thread: 2 Guest(s)