Skip to content
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a74bd1a
feat: Add palindrome check to basic logic problems (Closes #13501)
Arzoo1701 Oct 23, 2025
025f1db
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 23, 2025
10dae9e
fix: resolve Ruff and linting errors for palindrome_check.py
Arzoo1701 Oct 23, 2025
e906e59
Merge branch 'feature/palindrome-check' of https://github.com/Arzoo17…
Arzoo1701 Oct 23, 2025
ccd5989
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 23, 2025
fb207b5
fix: Resolve final W292 newline error
Arzoo1701 Oct 23, 2025
6a7d3c8
fix: Resolve final W292 newline error
Arzoo1701 Oct 23, 2025
d1701fe
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 23, 2025
e8ad0b5
fix: Resolve final W293 whitespace error
Arzoo1701 Oct 23, 2025
984ea67
fix: Resolve final W293 whitespace error
Arzoo1701 Oct 23, 2025
6ec0d24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 23, 2025
ec3a7e8
fix: Resolve final W293 whitespace error
Arzoo1701 Oct 23, 2025
e9951f9
fix: Resolve final W293 whitespace error
Arzoo1701 Oct 23, 2025
d85558d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 23, 2025
4aff923
fix: Final resolution for W293 whitespace
Arzoo1701 Oct 24, 2025
ace6b50
fix: Final resolution for W293 whitespace
Arzoo1701 Oct 24, 2025
5a7a617
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 24, 2025
ce8ab1e
fix: Final resolution for W293 whitespace
Arzoo1701 Oct 24, 2025
2ec106a
fix: Final resolution for W293 whitespace
Arzoo1701 Oct 24, 2025
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
37 changes: 37 additions & 0 deletions other/palindrome_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
def is_palindrome(text: str) -> bool:
"""
Checks if a string is a palindrome.

A palindrome is a word, phrase, number, or other sequence of characters
which reads the same backward as forward. This implementation is case-sensitive
and includes spaces and punctuation in the check.

Args:
text: The input string to check.

Returns:
True if the string is a palindrome, False otherwise.

Examples (Doctests):
>>> is_palindrome("madam")
True
>>> is_palindrome("racecar")
True
>>> is_palindrome("A man, a plan, a canal: Panama")
False
>>> is_palindrome("level")
True
>>> is_palindrome("hello")
False
"""
# Core logic: The simplest and most Pythonic way to reverse a string
# is using slicing: text[::-1].
# We compare the original string with its reversed version.
return text == text[::-1]


if __name__ == "__main__":
# Standard boilerplate for running documentation examples as tests.
import doctest

doctest.testmod()