- Cloud Native Python
- Manish Sethi
- 153字
- 2021-07-02 19:11:56
Functions
A function is a block of organized, self-contained programs that perform a specific task, which you can incorporate into your own larger programs. They are defined as follows:
# function def functionname(): do something return
These are a few points to remember:
- Indentation is very important in Python programs
- By default, parameters have a positional behavior, and you need to inform them in the same order that they were defined in
Please see the following code snippet example, which showcases functions:
def display ( name ): #This prints a passed string into this function print ("Hello" + name) return;
You can call the preceding function as follows:
display("Manish") display("Mohit")
The following screenshot shows the execution of the preceding display function:

Note that if you have more than one Python version installed on your system, you need to use Python 3 instead of Python, which uses the default version of Python (generally, 2.7.x).
推薦閱讀
- Design Principles for Process:driven Architectures Using Oracle BPM and SOA Suite 12c
- Vue.js 3.0源碼解析(微課視頻版)
- QGIS:Becoming a GIS Power User
- Rust Essentials(Second Edition)
- Oracle從入門到精通(第5版)
- Getting Started with Laravel 4
- Unity UI Cookbook
- MINECRAFT編程:使用Python語言玩轉(zhuǎn)我的世界
- C語言程序設(shè)計與應(yīng)用(第2版)
- 從零開始學(xué)Android開發(fā)
- 從程序員角度學(xué)習(xí)數(shù)據(jù)庫技術(shù)(藍(lán)橋杯軟件大賽培訓(xùn)教材-Java方向)
- UML軟件建模
- R語言實戰(zhàn)(第2版)
- Clojure編程樂趣
- HTML5程序設(shè)計基礎(chǔ)教程