diff --git a/intro/Task107.py b/intro/Task107.py index 759c80d..0717c42 100644 --- a/intro/Task107.py +++ b/intro/Task107.py @@ -1,11 +1,12 @@ def list_cubed(l: list) -> object: + result = 0 + if not l: - return 0 - - sum = 0 - - for i in range(l): - sum = sum + (i*i*i) - - return sum + return result + else: + length = len(l) + while length > 0: + result += pow(l[length - 1], 3) + length -= 1 + return result