@@ -1,5 +1,8 @@
|
||||
def max(list):
|
||||
if len(list) == 2:
|
||||
return list[0] if list[0] > list[1] else list[1]
|
||||
sub_max = max(list[1:])
|
||||
return list[0] if list[0] > sub_max else sub_max
|
||||
def max_(lst):
|
||||
if len(lst) == 0:
|
||||
return None
|
||||
if len(lst) == 1:
|
||||
return lst[0]
|
||||
else:
|
||||
sub_max = max_(lst[1:])
|
||||
return lst[0] if lst[0] > sub_max else sub_max
|
||||
|
||||
Reference in New Issue
Block a user