Write a function Pali(Sting S) to find whether S is palindrome or not.
To determine if a given string \( S \) is a palindrome, we need to check if the string reads the same forward and backward. A palindrome is a word, phrase, or sequence that remains the same when reversed, ignoring spaces, punctuation, and case sensitivity.
We can solve this problem by comparing each character of the string with its corresponding character from the end. If all characters match, the string is a palindrome; otherwise, it is not.
Here is how we can implement the function in Python:
```python
def Pali(S):
# Convert the string to lowercase to ensure case insensitivity
S = S.lower()
# Compare characters from both ends of the string
left = 0
right = len(S) - 1
while left < right:
______ ________ ______ __________ ___ _____ ____ ________.
________ _______ _____ ______ __________ ____ _____ ____ ____ _____ __________.
__________ __________ _____ __________ _________.
____ _______ ____ _____ ____ ______ _________ ______ ___ ________ ___ ______.
______ _______ _____ __________ _____ _______ _______ _________.
________ _____ ______ _______ __________ _________ _________.
______ ___ _______ __________ _______.
________ _______ __________ _________ _________ _____.
_________ _____ ______ ________ _____.
__________ ________ __________ _________ ____ _____ ______ _______ _________.
______ _________ _________ _______ ___ _________ _____ ______ ____ ____ ___ _____.
____ ___ ______ ______ __________ ______ _______ ____ ______ _________ ___ _______.
_________ __________ _______ ______ ________ _____ ___ _______ ______ ________ ___ _________.
________ _______ ____ __________ _____ ____ _________ __________ ___ __________ _______ ___.
____ ______ _________ ______ ________ ___ _________ ___ _____.
___ ____ _____ ___ ______ ______ ______ ________ ________ _______.
___ _________ __________ ________ _______ _____ _____ _____ ______ __________.
__________ _______ ____ _________ _______ _______ ____ ____.
___ _______ _____ ____ _______ _______.
_______ __________ _______ ____ _________ ___ ______ ___.
__________ ______ _____ ________ _______.
________ ___ _____ ___ __________ _______ __________.
_______ _________ __________ __________ __________ __________ ______ ___ _____.
____ ______ _____ ________ _____ ________ _______ _____ _________ _________ ______.
____ __________ _____ __________ _____ __________.
_______ ______ _____ ________.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
✓ Unlock up to 60% of the answer
✓ No payment required