diff --git a/13.py b/13.py index 71dbe09bdb32aa6db030404755b054d3a76e31db..f4fd17a960c4fcfa47f4d9e737758226ecf4d326 100644 --- a/13.py +++ b/13.py @@ -1,3 +1,6 @@ +# Write a function solve that returns the running sum of a list. +# The running sum is the sum of all elements up to each index. + def solve(nums): result = [nums[0]] for i in range(1, len(nums)): diff --git a/14.py b/14.py new file mode 100644 index 0000000000000000000000000000000000000000..a74cfdbbf3c35463fb6762f8ec3231d5805865dc --- /dev/null +++ b/14.py @@ -0,0 +1,6 @@ +# Write a function solve that reverses the words in a string. +# Words are separated by spaces. + +def solve(string): + list = reversed(string.split()) + return ' '.join(list) \ No newline at end of file