Function
definition and comprehension
key point :
组合数据类型在python中以指针
实现;因此若函数未定义真实的组合数据类型 (local variable) 则使用指针指向 外部 global variable; in practice alters the pointer means alters the global variable
- Definition
Eg:def <function name>(<parameter(0/lots)>): < main function statements> return < return value >
def fact(n): s=1 for i in range(1,n+1): s*=i #s=s*i return s # compute the n!
- Call function