Get startedGet started for free

Pylint

A coworker asks you to look over the following code for him.

def calculateMonthlyInterestRate(annual_interest_rate):
    """This function calculates monthly interest
        given the annual interest rate.
    """
    if annual_interest_rate >= 0:
        return annual_interest_rate / 12
    else:
        monthly_interest_rate = 0
    return round(monthly_interest_rate, 2)

monthly_rate = calculateMonthlyInterestRate(.06)
print(monthly_rate)

You load the file into your Python editor.

This exercise is part of the course

Case Study: Building Software in Python

View Course

Hands-on interactive exercise

Turn theory into action with one of our interactive exercises

Start Exercise