<jupyter_start><jupyter_text>Quiz 0105 (Solution)  Assignment: - Write a function named 'palindrome' to test whether the entered word or sentence is a palindrome.- Ignore capitalization, spaces, punctuation marks, symbols, etc. - Use the properties of 'queue' and 'stack' data structures.  Palindrome examples: - mom- wow- noon- level- radar- kayak- racecar- God's dog- Madam, I'm Adam<jupyter_code>def palindrome(d):
    b1 = ''
    letters1 = []

    for x in d:
        if x.isalpha():
            letters1.append(x.upper())
    
    letters2 = letters1[:]
    
    while letters1:    
        c = letters1.pop(0)                     # Dequeue as a queue.
        b1 += c
    
    b2 = ''
    while letters2:    
        c = letters2.pop()                      # Pop as a stack.
        b2 += c
    
    if b1 == b2:
        return True
    else:
        return False<jupyter_output><empty_output><jupyter_text>Test results:<jupyter_code>palindrome("Kayak")
palindrome("Madam, I'm Adam")
palindrome("Hello")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10961538461538461, 'fraction_numerical': 0.01826923076923077, 'mean_word_length': 2.347266881028939, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '233929', 'license': 'MIT', 'n_tokens_mistral': 355, 'n_tokens_neox': 339, 'n_words': 96, 'path': 'SIC_AI_Quizzes/SIC_AI_Chapter_02_Quiz/sol_0105.ipynb', 'repo_name': 'BattlePlot/SIC-Artificial-Intelligence', 'size': '1040'}