# Title: Simple and compound interest
# Heading: Python Program to Calculate Simple and Compound Interest
# Level: beginner
# Tags: simple interest, compound interest, interest formula, math
# About: Works out the simple and the compound interest on the same principal, rate and number of years, shown to two decimal places.

def simple_interest(principal, rate, years):
    """The interest on principal at rate percent a year."""
    return principal * rate * years / 100


def compound_interest(principal, rate, years):
    """The interest when it's compounded once a year."""
    amount = principal * (1 + rate / 100) ** years
    return amount - principal


print(f"Simple interest: {simple_interest(10000, 5, 3):.2f}")
print(f"Compound interest: {compound_interest(10000, 5, 3):.2f}")
