Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Palindrome Program Logic
00:00
5 left

Palindrome Program Logic

EasyPython

Problem

How would you determine if a word was a palindrome programmatically?

Implement is_palindrome(word) to return True when the word reads the same forward and backward, and False otherwise. The comparison is case-sensitive and uses each character exactly as provided.

Input and Output

  • Input: a string word.
  • Output: a Boolean indicating whether word is a palindrome.

Constraints

  • 0 <= len(word) <= 1000
  • word contains printable characters
  • The comparison is case-sensitive
  • Spaces and punctuation, if present, are treated as ordinary characters

Function Signature

def is_palindrome(word):
Interviewer

Your question is Palindrome Program Logic. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.