Last active
September 19, 2019 09:44
-
-
Save mauricioaniche/9735db28d7091dac0f701daca327313a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find(nums): | |
smallest = 9999 | |
highest = -9999 | |
for num in nums: | |
if num < smallest: | |
smallest = num | |
if num > highest: | |
highest = num | |
return smallest, highest | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from find import find | |
def test_decreasing_order(): | |
min, max = find([29, 28, 27, 26]) | |
assert min == 26 | |
assert max == 29 | |
def test_single_number(): | |
result = find([15]) | |
assert min == 15 | |
assert max == 15 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment