From c1fc537c5d2f0516272082bc59c38b1e80418363 Mon Sep 17 00:00:00 2001 From: Dragca Kvasnickova Date: Mon, 7 Apr 2025 13:14:28 +0200 Subject: [PATCH 1/2] 26 return True if sentence is palindrom --- 06/tasks/task_26_is_palindrome_sentence.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/06/tasks/task_26_is_palindrome_sentence.py b/06/tasks/task_26_is_palindrome_sentence.py index 359cce2..c00b5c7 100644 --- a/06/tasks/task_26_is_palindrome_sentence.py +++ b/06/tasks/task_26_is_palindrome_sentence.py @@ -4,4 +4,7 @@ def is_palindrome_sentence(s: str) -> bool: """ Vrátí True, pokud je věta palindrom (ignoruje mezery, interpunkci a velikost písmen). """ +# creates a list consisting only of lowercase letters of the original string + s_list = [char.lower() for char in list(s) if char.isalpha()] + return s_list == s_list[::-1] From 7868af8d559099fc0342559b058e9068e33ee63d Mon Sep 17 00:00:00 2001 From: Dragca Kvasnickova Date: Wed, 23 Apr 2025 12:48:14 +0200 Subject: [PATCH 2/2] 26 returns True if the sentence is plindrom --- 06/tasks/task_26_is_palindrome_sentence.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/06/tasks/task_26_is_palindrome_sentence.py b/06/tasks/task_26_is_palindrome_sentence.py index c00b5c7..e12ab46 100644 --- a/06/tasks/task_26_is_palindrome_sentence.py +++ b/06/tasks/task_26_is_palindrome_sentence.py @@ -5,6 +5,6 @@ def is_palindrome_sentence(s: str) -> bool: Vrátí True, pokud je věta palindrom (ignoruje mezery, interpunkci a velikost písmen). """ # creates a list consisting only of lowercase letters of the original string - s_list = [char.lower() for char in list(s) if char.isalpha()] + s_list = [char.lower() for char in s if char.isalpha()] return s_list == s_list[::-1]