hausaufgabe--python 18- Defined specific Functions

000-- Define a function which meets below criteria:

a- if the last parameter != 5, then get the sum of all the parameters and multiple base=3

b- if the last parameter ==5, then the base = 5 and mutiple the left parameter's sum.

 

 

 

 

running result:

 

 001-- define a function, to look for the data meet : abc = a^3+b^3+c^3

 

 

 

running result:

 

 

002--define a function to search how many times a sub String show in a target String

 

 

running result:

 

 

003-- functions decument 

def MyFirstFunction(name):
'函数文档在函数定义的最开头部分,用不记名字符串表示'
print('I love python.com!')

 

To access the clarification of the functions:

>>> MyFirstFunction.__doc__

oder:

help(MyFirstFunction)

 

005--key parameter

 

 

 

 

 

006-- default parameter

 

posted @ 2017-06-14 23:12  ReedyLi  阅读(233)  评论(0编辑  收藏  举报