#-*-coding:utf-8-*- ''' 写函数,获取最大值 ''' def func(a,b): if a>b: return a else: return b print(func(1,99)) ''' 三元运算符 1、必须有结果 2、必须有if和else 3、必须是简单的情况 ''' a = 1 b = 2 c =a if a>b else b print(c) def fucq(a,b): return a if a>b else b print(fucq(9,1))
Python(68)_写函数,计算最大值
猜你喜欢
转载自www.cnblogs.com/sunnybowen/p/10262642.html
今日推荐
周排行