Question: Here s a sample Computer Science program question: - - - * * Question: * * Write a Python program to determine if a given

Heres a sample Computer Science program question:
---
**Question:**
Write a Python program to determine if a given string is a palindrome. A palindrome is a word, phrase, or sequence that reads the same backward as forward (e.g., "madam" or "racecar"). Ignore spaces, punctuation, and case sensitivity.
**Requirements:**
1. Prompt the user to enter a string.
2. Remove all non-alphanumeric characters from the string and convert it to lowercase.
3. Check if the cleaned string reads the same forwards and backwards.
4. Print `"The string is a palindrome"` if the string meets the condition, and `"The string is not a palindrome"` otherwise.
**Sample Input/Output:**
-**Input**: "A man, a plan, a canal, Panama!"
**Output**: "The string is a palindrome."
-**Input**: "Hello, World!"
**Output**: "The string is not a palindrome."
**Correct Answer Explanation:**
A palindrome remains the same when read from both ends. By removing non-alphanumeric characters and lowering the case, we normalize the string for easy comparison.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!