diff --git a/maths/find_max.py b/maths/find_max.py index 7cc82aacfb09..8b5ab48e6185 100644 --- a/maths/find_max.py +++ b/maths/find_max.py @@ -2,15 +2,23 @@ def find_max(nums): + """ + >>> for nums in ([3, 2, 1], [-3, -2, -1], [3, -3, 0], [3.0, 3.1, 2.9]): + ... find_max(nums) == max(nums) + True + True + True + True + """ max = nums[0] for x in nums: if x > max: max = x - print(max) + return max def main(): - find_max([2, 4, 9, 7, 19, 94, 5]) + print(find_max([2, 4, 9, 7, 19, 94, 5])) # 94 if __name__ == "__main__":