Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. #a function to calculate and return interest amount
  2. def SimpleInterest(principle_amount, interest_rate, years):
  3.     interest_amount = (principle_amount*interest_rate*years)/100
  4.     return interest_amount
  5.  
  6. def main():
  7.     #taking input from user for principle, interest rate, years
  8.     principle_amount = float(input("Enter the principal amount: "))
  9.     interest_rate = float(input("Enter the interest rate: "))
  10.     years = int(input("Enter the number of years: "))
  11.  
  12.  
  13.  
  14.  
  15.     #calling the previous function and printing it
  16.     print("The interest amount is: " +  str(SimpleInterest(principle_amount,interest_rate,years)))
  17.  
  18. if __name__ == "__main__":
  19.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement