Created
May 7, 2018 22:29
-
-
Save ariesabao/4a0ecbeae7d5e2dc0cac87b4005b151a to your computer and use it in GitHub Desktop.
Codewars | Sum of two lowest positive integers
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
"""Create a function that returns the sum of the two lowest positive numbers | |
given an array of minimum 4 integers. No floats or empty arrays will be | |
passed. | |
For example, when an array is passed like [19, 5, 42, 2, 77], | |
the output should be 7. | |
[10, 343445353, 3453445, 3453545353453] should return 3453455. | |
Hint: Do not modify the original array. """ | |
#This is my noob entry on codewars challenge | |
def sum_two_smallest_numbers(numbers): | |
numbers.sort() | |
result = sum(numbers[0:2]) | |
return result | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment