Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions python/tasks/task_19_is_palindrome.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# task_19_is_palindrome.py

def is_palindrome(s: str) -> bool:
"""
Vrátí True, pokud je řetězec palindrom.
"""

cislo = len(s)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cislo není vhodný název proměnné. Proměnné prosím pojmenovávej tak, aby šlo poznat k čemu slouží. Tady navhuji například delka_vstupu nebo anglicky input_length.

for i in range(cislo//2):
if s[i] != s[-i-1]:
return False
return True