Skip to content

added find max value algorithm #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions allalgorithms/numeric/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .max_numbers import find_max
16 changes: 16 additions & 0 deletions allalgorithms/numeric/max_numbers.py
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions tests/test_numeric.py
Original file line number Diff line number Diff line change
@@ -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()