Pylint
Un collègue vous demande de relire le code suivant pour lui.
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)
Vous chargez le fichier dans votre éditeur Python.
Cet exercice fait partie du cours
<cours>Étude de cas : développer un logiciel en Python</cours>Exercice interactif pratique
Transformez la théorie en action avec l’un de nos exercices interactifs
Commencer l’exercice