Récupérer une variable d'une fonction dans une autre fonction.
Ryan_Kafan
Messages postés
1
Date d'inscription
Statut
Membre
Dernière intervention
-
dachiasse Messages postés 1709 Date d'inscription Statut Membre Dernière intervention -
dachiasse Messages postés 1709 Date d'inscription Statut Membre Dernière intervention -
Def t5():
svt = 33
chimie = 33.5
total1 = svt + chimie
Def t6():
maths = 18
histoire = 9.5
total2 = maths + chimie
Def t7():
total3 = total1 + total2
Comment je peux récupérer total1 de t5() et total2 de t6() pour effectuer l'opération dans t7()?
Merci
svt = 33
chimie = 33.5
total1 = svt + chimie
Def t6():
maths = 18
histoire = 9.5
total2 = maths + chimie
Def t7():
total3 = total1 + total2
Comment je peux récupérer total1 de t5() et total2 de t6() pour effectuer l'opération dans t7()?
Merci
A voir également:
- Récupérer une variable d'une fonction dans une autre fonction.
- Fonction si et - Guide
- Recuperer une conversation whatsapp supprimée - Guide
- Comment recuperer une video sur youtube - Guide
- Excel remplir automatiquement une cellule en fonction d'une autre ✓ - Forum Excel
- Fonction moyenne excel - Guide
1 réponse
Salut,
Par un simple return, ça sert à cela.
Par un simple return, ça sert à cela.
def t5(): svt = 33 chimie = 33.5 return svt + chimie def t6(): maths = 18 histoire = 9.5 # peut mieux faire :D return maths + histoire def t7(total_param1, total_param2) return total_param1 + total_param2 total1 = t5() total2 = t6() total3 = t7(total1, total2) #si tu veux afficher le résultat : print(f"Le total des notes est : {total3}")