livepython.net

101. Python Program to Check if a String Is a Palindrome

MediumIndex and slice

Overview

Reverse a string with a slice, then decide with if and else.

Problem Statement

A palindrome is a word that reads the same forwards and backwards, like level. Read one word (all small letters) and print whether it is a palindrome. For example, for level:

level is a palindrome

and for python:

python is not a palindrome

Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.

Input

One word in small letters. Example:

level

Output

The output for that example:

level is a palindrome

The tests try 5 different inputs.

Learn this firstChapter 12 · Python String Indexing and Slicing
solution.py
# write your code here

EXPECTED OUTPUT

1level is a palindrome

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.