Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the return value of the python function

Shulou Source: shulou.com Published: 2022-06-01 07:57:09 09月16日 Update

Editor to share with you what the return value of the python function is, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The return value of the function

How to return results and what to do with multiple results?

# function return value # concept: the function will return an object after execution. If there is a return inside the function, it can return the actual value. # otherwise, it will return an empty None# type: any type can be returned, and the return value type should depend on the type followed by return # purpose: return data to the caller # multiple return keywords can appear in a function body But surely only one return keyword can be returned # if return is executed in the body of a function, it means that the function is launched, and the code statement after return will not execute def Sum (a sum=a+b passSum b): sum=a+b passSum (10jue 30)

Def Sum (sum=a+b return sum b): sum=a+b return sum # returns the return value of the function to the caller passprint (Sum (10) 30) # to the place where it was called

Def Sum (a rs b): sum=a+b return sum # will return to the caller passrs=Sum (10) 30) # assign the return value to another variable print (rs) # the return value of the function will be returned to the place where it was called

Def calComputer (num): result=0 iTunes 1 while I

Tags: Function type parameter data article key keyword content place multiple user result not much code depends on variable most actual object meaning Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Docker Microsoft Apple vpn