python方法参数默认值示例,python默认值示例,def boxVolum
文章由Byrx.net分享于2019-03-23 07:03:38
python方法参数默认值示例,python默认值示例,def boxVolum
def boxVolume( length = 1, width = 1, height = 1 ): return length * width * heightprint 'The default box volume is:', boxVolume()print '\nThe volume of a box with length 10,'print 'width 1 and height 1 is:', boxVolume( 10 )print '\nThe volume of a box with length 10,'print 'width 5 and height 1 is:', boxVolume( 10, 5 )print '\nThe volume of a box with length 10,'print 'width 5 and height 2 is:', boxVolume( 10, 5, 2 )
评论关闭