Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Quick recap
Indexing and slicing
14. Reversing strings


Great! If you use a negative index as the step, you can actually reverse a string! Take a look:

alphabet = 'abcdefghijklmnopqrstuvwyxz'

The code alphabet[::-1] means "take all characters (with no lower or upper bound) and go back one index at a time." As a result, we'll get a reversed string!


Ask the user to provide a palindrome, a word that reads the same backwards and forwards: Write a palindrome:

If the input is an actual palindrome, write: Correct palindrome. Otherwise write: Not a palindrome.

Stuck? Here's a hint!

To check if the user entered a palindrome, use == palindrome[::-1].