mardi 15 septembre 2020

How to check which variable a fuction has returned?

I have just starting my programming journey with Python and I came across this problem that may be completely irrelevant or have an obvious answer.

def add(x, y):
    total = x + y
    return total

#This isn't my actual code, but a simplified version to make you understand my question :D  

So what I would like to know is if it is possible for me to check with an if-statement if the function add() returns the variable total (or which return value it returns if there would be multiple return value options). I will try my best with further explanation if this seems unclear to you.

Aucun commentaire:

Enregistrer un commentaire