- Python Programming with Raspberry Pi
- Sai Yamanoor Srihari Yamanoor
- 108字
- 2021-07-02 23:48:48
Functions in Python
We briefly discussed functions in Python. Functions execute a predefined set of task. print is one example of a function in Python. It enables printing something to the screen. Let's discuss writing our own functions in Python.
A function can be declared in Python using the def keyword. A function could be defined as follows:
def my_func():
print("This is a simple function")
In this function my_func, the print statement is written under an indented code block. Any block of code that is indented under the function definition is executed when the function is called during the code execution. The function could be executed as my_func().
推薦閱讀
- PPT,要你好看
- Mastering Matplotlib 2.x
- 數據挖掘實用案例分析
- 機器學習與大數據技術
- B2B2C網上商城開發指南
- 網絡化分布式系統預測控制
- Grome Terrain Modeling with Ogre3D,UDK,and Unity3D
- Red Hat Linux 9實務自學手冊
- Machine Learning with the Elastic Stack
- Salesforce for Beginners
- 大數據技術基礎:基于Hadoop與Spark
- 自動化生產線安裝與調試(三菱FX系列)(第二版)
- Hands-On Data Warehousing with Azure Data Factory
- 三菱FX/Q系列PLC工程實例詳解
- 工業機器人力覺視覺控制高級應用