Python function

Python use keyword def to define a function. The content lines of the function do not need to be inside { ... } like other languages, but use indent in front of the line. Let define a funtion addup:

>>> def addup(a,b,c):
... return a + b + c
...
>>> addup(3,4,5)
12
return keyword can be used for data return.




















endmemo.com © 2024  | Terms of Use | Privacy | Home