Python知识学习11——函数

函数可以将代码模块化,便于代码的维护和管理,提高代码的复用性,同时也可以降低代码的耦合程度。

函数在定义之后需要调用才会运行。

这里介绍一下Python当中的函数的定义和调用:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def print_fozu():
print(" _ooOoo_ ")
print(" o8888888o ")
print(" 88 . 88 ")
print(" (| -_- |) ")
print(" O\\ = /O ")
print(" ____/`---'\\____ ")
print(" . ' \\| |// `. ")
print(" / \\||| : |||// \\ ")
print(" / _||||| -:- |||||- \\ ")
print(" | | \\\\\\ - /// | | ")
print(" | \\_| ''\\---/'' | | ")
print(" \\ .-\\__ `-` ___/-. / ")
print(" ___`. .' /--.--\\ `. . __ ")
print(" ."" '< `.___\\_<|>_/___.' >'"". ")
print(" | | : `- \\`.;`\\ _ /`;.`/ - ` : | | ")
print(" \\ \\ `-. \\_ __\\ /__ _/ .-` / / ")
print(" ======`-.____`-.___\\_____/___.-`____.-'====== ")
print(" `=---=' ")
print(" ")
print(" ............................................. ")
print(" 佛祖镇楼 BUG辟邪 ")
print(" Zen of python: ")
print(" Beautiful is better than ugly.; ")
print(" Explicit is better than implicit. ")
print(" Simple is better than complex. ")
print(" Complex is better than complicated. ")
print(" Flat is better than nested. ")
print(" Sparse is better than dense. ")
print(" Readability counts. ")
print(" Now is better than never. ")
print_fozu()