From a1ac3aa350e89d7ed50643882f9294d7741289ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iida=20Pyykk=C3=B6nen?= <iapyyk@utu.fi> Date: Tue, 14 Jan 2025 14:21:28 +0200 Subject: [PATCH] added 14 --- 13.py | 3 +++ 14.py | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 14.py diff --git a/13.py b/13.py index 71dbe09..f4fd17a 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 0000000..a74cfdb --- /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 -- GitLab