首页 > 编程语言 > 详细

hausaufgabe--python 18- Defined specific Functions

时间:2017-06-14 23:51:08      阅读:334      评论:0      收藏:0      [点我收藏+]

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

原文:http://www.cnblogs.com/Shareishappy/p/7011495.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!