r/PythonLearning • • Jun 30 '25

Check palindrome

Post image

Check whether word in reverse order is the same or not like : mom,racecar,madam

57 Upvotes

76 comments sorted by

View all comments

Show parent comments

1

u/N0-T0night Jul 01 '25

Emordnilaps like wt?

1

u/Legoracyro Jul 01 '25

Just any word that spelled backwards, is also another word.

draw - ward

edit - tide

live - evil

loop - pool

part - trap

1

u/N0-T0night Jul 01 '25

Give me hint how 2 do thatπŸ˜‚πŸ˜‚

1

u/Legoracyro Jul 01 '25

Still learning myself, so there may be a more efficient way to do it, but from what I remember while doing it myself, was to loop trough each word in the list, reversing it, and then looping through another time to check if the reversed word comes up. If that makes sense.

Doing that, you'll also get all the palindromes. Try to find a way to rule out any that show up, so you only get the emordnilaps.