Created
November 15, 2023 02:47
-
-
Save JTSGIT/a0df2e0f104ca7fb18783b86992e910b to your computer and use it in GitHub Desktop.
Kata1.py
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 sumLargestNumbers(numbers): | |
""" | |
This function receives a list of numbers and returns the sum of the two largest numbers in the list. | |
""" | |
sorted_numbers = sorted(numbers, reverse=True) | |
return sorted_numbers[0] + sorted_numbers[1] | |
print(sumLargestNumbers([1, 10])) # Expected output: 11 | |
print(sumLargestNumbers([1, 2, 3])) # Expected output: 5 | |
print(sumLargestNumbers([10, 4, 34, 6, 92, 2])) # Expected output: 126 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment