In: Computer Science
Python 3:
Write a function called Interest with floating point parameters Amount and InterestPercent that calculates the simple interest on Amount using InterestPercent as the interest rate.The function should return the interest amount.
Please upvote if you like the answer, as it helps the community a lot.
Also if you have any doubts, feel free to ask in comments, we will reach you ASAP.
NOTE: Be careful with the indentation, because they are very important in Python.
CODE(InterestCalculator.py):
# ANSWER STARTS
# function that returns Interest
def interest(Amount,InterestPercent):
InterestAmount = 0.01*InterestPercent*Amount
return InterestAmount
# ANSWER ENDS
# testing the written function
Amount = 10000
InterestPercent = 5
Interest = interest(Amount,InterestPercent)
print("Interest: " + str(Interest))
SAMPLE OUTPUT: