Palindrome check

Report a typo

To find out if a word is a palindrome we would need to check if it reads the same forward and backward.

The condition for that check has already been written in the code below, but the parts that need to be compared haven't been defined yet. Finish the code by defining variables forward and backward.

The variable that stores the word in question is called word.

You can use word as the value of forward. What should then the value of backward be?

Sample Input 1:

kayak

Sample Output 1:

Yes

Sample Input 2:

laptop

Sample Output 2:

No
Write a program in Python 3
# please work with the preset variable `word`
forward = # define here
backward = # define here

if forward == backward:
print("Yes")
else:
print("No")
___

Create a free account to access the full topic