diff --git a/allalgorithms/numeric/__init__.py b/allalgorithms/numeric/__init__.py new file mode 100644 index 0000000..cd1f5cc --- /dev/null +++ b/allalgorithms/numeric/__init__.py @@ -0,0 +1 @@ +from .max_numbers import find_max \ No newline at end of file diff --git a/allalgorithms/numeric/max_numbers.py b/allalgorithms/numeric/max_numbers.py new file mode 100644 index 0000000..122734a --- /dev/null +++ b/allalgorithms/numeric/max_numbers.py @@ -0,0 +1,16 @@ +# -*- coding: UTF-8 -*- +# +# Numeric Algorithms +# The All â–²lgorithms library for python +# +# Contributed by: Becky +# Github: @beckyw5 +# + + +def find_max (L): + max = 0 + for x in L: + if x > max: + max = x + return max diff --git a/tests/test_numeric.py b/tests/test_numeric.py new file mode 100644 index 0000000..2be532d --- /dev/null +++ b/tests/test_numeric.py @@ -0,0 +1,13 @@ +import unittest + +from allalgorithms.numeric import find_max + + +class TestMax(unittest.TestCase): + + def test_find_max_value(self): + test_list = [3, 1, 8, 7, 4] + self.assertEqual(8, find_max(test_list)) + +if __name__ == "__main__": + unittest.main() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy