Func in Python represents a custom function. Func is just a function name. Its name is not fixed. The parameters of a custom function include no parameters. You can also pass necessary parameters based on the function kinetic energy. , positional parameters and keyword parameters, etc.
When Xiaobai is learning python, he will encounter func and be confused! what does it mean? In python, func represents a custom function. Functions in Python are divided into built-in functions and custom functions. Built-in functions are built into Python itself, while func functions are artificially defined. func is just a function name. The name is not fixed. You can choose other names, but avoid conflicting with python keywords!
How to define functions in python?
A function code block begins with the def keyword, followed by the function identifier name and parentheses ().
Any incoming parameters and independent variables must be placed between parentheses. Parameters can be defined between parentheses.
The first line of a function can optionally use a documentation string - used to store function descriptions.
return [expression] Ends the function and optionally returns a value to the caller. Return without expression is equivalent to returning None
1, no parameters
2, required parameters
3. Keyword parameters
Using keyword parameters allows the order of parameters when the function is called to be inconsistent with the order of declaration
4. Default parameters
The above is the detailed content of What does func mean in python?. For more information, please follow other related articles on the PHP Chinese website!