From 67d409b6be5f90c33e73ddf73ba2966d8f2c44f4 Mon Sep 17 00:00:00 2001 From: Uyen Date: Mon, 22 Oct 2018 14:36:08 -0400 Subject: [PATCH 1/2] Find max function in python --- Maths/FindMax.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Maths/FindMax.py diff --git a/Maths/FindMax.py b/Maths/FindMax.py new file mode 100644 index 000000000..d16a9dc1f --- /dev/null +++ b/Maths/FindMax.py @@ -0,0 +1,10 @@ +# NguyenU + +import math + +def find_max(nums): + max = 0 + for x in nums: + if x > max: + max = x + print max From 45a1ab213e4cfd94061348c7c3de20dcc7de94e8 Mon Sep 17 00:00:00 2001 From: Harshil Date: Mon, 22 Oct 2018 20:42:08 +0200 Subject: [PATCH 2/2] Update FindMax.py --- Maths/FindMax.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Maths/FindMax.py b/Maths/FindMax.py index d16a9dc1f..451ba0363 100644 --- a/Maths/FindMax.py +++ b/Maths/FindMax.py @@ -1,10 +1,15 @@ # NguyenU import math - def find_max(nums): max = 0 for x in nums: if x > max: max = x - print max + print(max) + +def main(): + find_max([2, 4, 9, 7, 19, 94, 5]) + +if __name__ == '__main__': + main()