首页 > 代码库 > hausaufgabe--python 18- Defined specific Functions

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

技术分享

 

hausaufgabe--python 18- Defined specific Functions