- 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().
推薦閱讀
- Circos Data Visualization How-to
- R Machine Learning By Example
- 機器人智能運動規劃技術
- ROS機器人編程與SLAM算法解析指南
- Associations and Correlations
- 21天學通Visual C++
- 中國戰略性新興產業研究與發展·工業機器人
- 軟件構件技術
- Excel 2007終極技巧金典
- 案例解說Delphi典型控制應用
- Hadoop Beginner's Guide
- PowerPoint 2010幻燈片制作高手速成
- Serverless Design Patterns and Best Practices
- Hands-On Generative Adversarial Networks with Keras
- ARM嵌入式開發實例