Question du test Python

Écrire une fonction Python qui retourne la somme des n premiers entiers.

Difficile

Que peut-on dire sur la fonction ma_fonction ? (une seule bonne réponse)


import decimal
def ma_fonction(nombre_decimal, number):
    """Retourne nombre_decimal au carré, calculé avec number chiffres significatifs"""
    with decimal.localcontext() as ctx:
        ctx.prec = number
        return nombre_decimal*nombre_decimal
resultat=ma_fonction(decimal.Decimal('12.121212'),7)
Auteur: Antoine BrennerStatut : PubliéeQuestion passée 1720 fois
Modifier
0
Évaluations de la communauté
developer avatar
Victor
11/10/2021
Je peux pas voir l'image, elle est mal cadré
developer avatar
Vincent Cotro
18/10/2021
La question a été réécrite en markdown ! Merci.