diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ad7c5ab --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +.idea/ +*.iml +.vscode +__pycache__ +*pyc +*.ipynb_checkpoints \ No newline at end of file diff --git a/README.md b/README.md index b247ebf..c12717d 100644 --- a/README.md +++ b/README.md @@ -1 +1,8 @@ -# PythonFundamentals.Exercises.Algos \ No newline at end of file +# PythonFundamentals.Exercises.Algos + +## Binary Search + +1. Open module search.py. +2. Fill in the function "binary_search". +3. Make sure to include unit tests in test_search.py. + diff --git a/search.py b/search.py new file mode 100644 index 0000000..c8a72f4 --- /dev/null +++ b/search.py @@ -0,0 +1,9 @@ +from typing import List, Optional +import logging + + +def binary_search(list_in: List[int], item: int) -> Optional[int]: + """ + If item exists in list_in, this function returns its position in the list. + """ + pass diff --git a/test_search.py b/test_search.py new file mode 100644 index 0000000..0b53ddd --- /dev/null +++ b/test_search.py @@ -0,0 +1,12 @@ +import unittest +import search +import logging + +logging.basicConfig(level=logging.INFO) + + +class SearchTest(unittest.TestCase): + + def test_binary_search(self): + pass +