jeudi 7 janvier 2021

Python : How to return two values from function which is called from elif?

The elif someother_function(): here check if it is true and also need to print the returned value. Can anyone help me with this?

def some_function():
     if correct:
         return True
     else:
         return False

def someother_function():
     if correct:
         return True,f
     else:
         return False,None


if some_function():
     print("something")
elif someother_function():
     print(f)
else:
     print("nothing")

Here, how to return f from someother_function to where it called at elif?

Aucun commentaire:

Enregistrer un commentaire