From d954a62fe9a306ca1750047cf9a4fb8726dc8b7c Mon Sep 17 00:00:00 2001 From: Roman Dmytruk Date: Tue, 29 Sep 2026 14:46:37 +0000 Subject: [PATCH] Update u2/list_ops.py --- u2/list_ops.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/u2/list_ops.py b/u2/list_ops.py index 72b4ca4..43fcd5f 100644 --- a/u2/list_ops.py +++ b/u2/list_ops.py @@ -1,8 +1,4 @@ -def length(l): - count = 0 - for item in l: - count +=1 - return count + def append(list1, list2): result = [] @@ -12,3 +8,21 @@ def append(list1, list2): result += [item] return result +def concat(lists): + result = [] + for sublist in lists + result = append(result, sublist) + return result + +def filter(function, list): + result = [] + for item in list: + if function(item): + result += [item] + return result + +def length(l): + result = 0 + for item in l: + result +=1 + return result \ No newline at end of file