Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Palindrome Function Writing

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Palindrome Function Writing. Start with the requirements on the right.

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.

Problem

Drw QA test labels occasionally use mirrored identifiers for fixture validation. Write a function that returns whether a string is a palindrome.

A palindrome reads exactly the same from left to right and right to left. Compare every character as provided: comparisons are case-sensitive, and spaces or punctuation count as characters.

Formal Specification

Implement is_palindrome(text).

  • Input: text, a string.
  • Output: True if text is a palindrome, otherwise False.

Constraints

  • 0 <= len(text) <= 100,000
  • text contains printable ASCII characters
  • Character comparison is case-sensitive
  • Spaces and punctuation are treated as ordinary characters

Function Signature

def is_palindrome(text):
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output