ComenzarEmpieza gratis

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.

Este ejercicio forma parte del curso

Case Study: Building Software in Python

Ver curso

Ejercicio interactivo práctico

Pon en práctica la teoría con uno de nuestros ejercicios interactivos

Empezar ejercicio