From 9db98acedeacdf531d7addbb8f4f466fa34c5d48 Mon Sep 17 00:00:00 2001 From: TiagoRG <35657250+TiagoRG@users.noreply.github.com> Date: Fri, 3 Feb 2023 17:32:28 +0000 Subject: [PATCH] Quick simplification fix --- 1ano/1semestre/fp/extra3/ex02.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/1ano/1semestre/fp/extra3/ex02.py b/1ano/1semestre/fp/extra3/ex02.py index 06af1d6..5809bdc 100644 --- a/1ano/1semestre/fp/extra3/ex02.py +++ b/1ano/1semestre/fp/extra3/ex02.py @@ -5,12 +5,8 @@ # os primeiros n elementos igualam os últimos n elementos (sem sobreposição). def firstEqualLast(lst): - if len(lst) <= 1: - return 0 - n = 0 for i in range(1, len(lst)//2+1): - if lst[:i] == lst[len(lst)-i:]: + if lst[:i] == lst[-i:]: n = i - return n