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 exercício faz parte do curso
Case Study: Building Software in Python
Exercício interativo prático
Transforme a teoria em ação com um de nossos exercícios interativos
