Python Palindrome Check
s == s[::-1]Practice

Does the word read the same backwards?

Compare the original string to s[::-1]. Press Run to watch each character pair match.

Picture this: same forwards and backwards

Reverse the string, then compare character by character.

soriginal
→
s[::-1]reversed
→
equal?Yes / No

In easy words

A palindrome is text that looks identical when you flip it. level works; hello does not.

Where this is used

IDs, puzzle games, DNA symmetry checks, and any validation that needs a mirrored string.

Run algorithm

Each step highlights the matching Python line. Program output appears only when a line that prints actually runs.

Ready
forward
s[::-1]
?
1s = input()
2rev = s[::-1]
3print("Yes" if s == rev else "No")
Output:

Example Program

1s = input()
2print("Yes" if s == s[::-1] else "No")