- 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().
推薦閱讀
- 教父母學(xué)會上網(wǎng)
- TestStand工業(yè)自動化測試管理(典藏版)
- 條碼技術(shù)及應(yīng)用
- Zabbix Network Monitoring(Second Edition)
- JMAG電機(jī)電磁仿真分析與實例解析
- Visual C# 2008開發(fā)技術(shù)詳解
- MATLAB/Simulink權(quán)威指南:開發(fā)環(huán)境、程序設(shè)計、系統(tǒng)仿真與案例實戰(zhàn)
- Machine Learning with Apache Spark Quick Start Guide
- 筆記本電腦維修90個精選實例
- 基于Proteus的單片機(jī)應(yīng)用技術(shù)
- Photoshop CS4數(shù)碼攝影處理50例
- 深度學(xué)習(xí)原理與 TensorFlow實踐
- 信息系統(tǒng)安全保障評估
- 大話數(shù)據(jù)科學(xué):大數(shù)據(jù)與機(jī)器學(xué)習(xí)實戰(zhàn)(基于R語言)
- Learning OpenShift