Search⌘ K
AI Features

Puzzle 28: Explanation

Explore how to reverse strings in Python using slicing with negative steps, understand start stop and step parameters, and verify palindrome detection by running sample code.

We'll cover the following...

Try it yourself

Try executing the code below to verify the results:

Python 3.8
pali = 'Was it a cat I saw?'
print(pali[::-1])

“Was it a cat I saw?” is a palindrome. A palindrome can be read the same backward and forward. ...

Explanation