Vrai/Faux : Définir une fonction Python (niveau 1)
Créez un compte gratuit pour suivre votre avancement et reprendre où vous avez laissé.
Créer un compteObjectifs travaillés
Pour chaque affirmation suivante sur la définition et l'appel d'une fonction Python, indiquez si elle est Vraie ou Fausse.
Déroulement pas à pas (Correction et Indices)
Question 1 : Affirmation : En Python, on définit une fonction à l'aide du mot-clé def.
- (Correct) Vrai
- (Incorrect) Faux
Question 2 : Affirmation : Une fonction Python doit obligatoirement comporter une instruction return.
- (Incorrect) Vrai
- (Correct) Faux
Question 3 : Affirmation : Une fonction Python peut recevoir plusieurs paramètres, séparés par des virgules.
- (Correct) Vrai
- (Incorrect) Faux
Question 4 : On considère le programme Python ci-dessous :
def double(x) :
return 2*x
print(double(7))
Affirmation : Ce programme affiche $14$.
def double(x) :
return 2*x
print(double(7))- (Correct) Vrai
- (Incorrect) Faux
Question 5 : Affirmation : Pour appeler une fonction sans paramètre, on peut omettre les parenthèses.
- (Incorrect) Vrai
- (Correct) Faux
Question 6 : On considère le programme Python ci-dessous :
def ajoute(x, y) :
return x + y
a = ajoute(4, 3)
print(a)
Affirmation : Ce programme affiche $43$.
def ajoute(x, y) :
return x + y
a = ajoute(4, 3)
print(a)- (Incorrect) Vrai
- (Correct) Faux