Which data structure do we use for testing a palindrome ?
Added by Paula M.
Step 1
) reads the same forwards and backwards (is a palindrome). Show more…
Show all steps
Your feedback will help us improve your experience
Crystal Wang and 71 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
A palindrome is a string that reads the same forward and backward. Describe an algorithm for determining whether a string of $n$ characters is a palindrome.
Algorithms
Write a function named palindrome_word(). It takes in a string as the only parameter. It returns True if the string is a palindrome by words. Otherwise, it returns False. A sample run of one possible implementation is shown below.
Alexandra D.
7.9 LAB: Palindrome A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," and "never odd or even." Ex: If the input is "bob," the output is: "bob is a palindrome." Ex: If the input is "bobby," the output is: "bobby is not a palindrome." Hint: Start by removing spaces. Then check if a string is equivalent to its reverse.
Akash M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
100,000+
Students learning Computer Science with Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD