Question: Code for PYTHON FULL CODE PLEASE Palindromic String A string is palindromic if it reads the same forwards and backwards. For example, radar and racecar
Code for PYTHON
FULL CODE PLEASE
Palindromic String
A string is palindromic if it reads the same forwards and backwards. For example, radar and racecar are palindromes. In this programming exercise you will read in a string and return the smallest string that is palindromic by adding letters to the beginning of the string.
Input: You will read the data from a file called palindrome.txt. This file will have one string per line. Each string will have 1 to 100 lower case characters from a to z. There will be no digits, punctuation marks, or spaces in those strings.
Output: Your output will be the shortest palindrome that you can make by adding letters to the beginning of the string. There will be one palindrome per line in your output.
Sample Input:
a aa ab madam cbabcde
Sample Output:
a aa bab madam edcbabcde
Below is a set of test cases: racecar racecars acecar ecar car rada radar rad rradar radardevice Below is the correct output: racecar sracecars racecar racecar racar adarada radar darad radarradar ecivedradardevice
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
