p=float(input("Please enter principle amount: ")) t=float(input("Please enter the time in years: ")) r=float(input("Please enter the rate of interest: ")) ci=p*pow((1+r/100),t); #gives compound amount, interest with principle amount print("\n compound amount is: \n",ci); ci=p*pow((1+r/100),t)-p; #gives only compound interest */ print("\n compound interest is:\n",ci); Output: Please enter principle amount: 5000 Please enter the time in years: 3 Please enter the rate of interest: 4 compound amount is: 5624.32 compound interest is: 624.32