Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Palindrome🔝 #100

Open
MaherAssaf19 opened this issue Jan 12, 2025 · 0 comments
Open

The Palindrome🔝 #100

MaherAssaf19 opened this issue Jan 12, 2025 · 0 comments
Assignees
Labels
challenge a new challenge

Comments

@MaherAssaf19
Copy link

The task is to create a function that checks if a given string is a palindrome. A palindrome is a word or phrase that reads the same forwards and backwards, ignoring spaces, punctuation, and case sensitivity.

"""
A module to check if a given string is a palindrome.

Module contents:
    - is_palindrome: checks if a string reads the same forwards and backwards.

Created on 03-01-25

"""


def is_palindrome(input_string: str) -> bool:
    """
    Checks if a string is a palindrome.

    Parameters:
        input_string (str): The string to be checked.

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

    Raises:
        TypeError: If the input is not a string.

    Examples:
        >>> is_palindrome("madam")
        True

        >>> is_palindrome("hello")
        False

        >>> is_palindrome("")
        True
    """
    if not isinstance(input_string, str):
        raise TypeError("Input must be a string.")
    return input_string == input_string[::-1]
@MaherAssaf19 MaherAssaf19 added the challenge a new challenge label Jan 12, 2025
@MaherAssaf19 MaherAssaf19 self-assigned this Jan 12, 2025
@abdoalsir abdoalsir moved this from TODO to DONE in ET6 Foundations Group 17 Jan 12, 2025
@abdoalsir abdoalsir moved this from DONE to TODO in ET6 Foundations Group 17 Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
challenge a new challenge
Projects
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant