A palindrome is a string that, when reversed, is equal to itself. Example of the palindrome includes:
676, 616, mom, 100001.
You have to take a number as an input from the user. You have to find the next palindrome corresponding to that number. Your first input should be the number of test cases and then take all the cases as input from the user.
Enter the number of test cases: 4
Please enter an input: 666
Please enter an input: mom
Please enter an input: hill
Please enter an input: 789
666 is a pallindrom
mom is a pallindrom
hill is not a palindrome
789 is not a palindrome
The next possible pallindrome is 797
The task you have to perform is “Palindromify the List.” The task is very similar to the previous one
You are given a list that contains some numbers. You have to print a list of the next palindromes only if the number is greater than 17; otherwise, you will print that number.
Input:
[1, 6, 87, 43]
Output:
[1, 6, 88, 44]
Your laptop with 3.6.x (onwards) installed.
NOTE: Those with Linux and MacOSX would have Python installed by default, no action required.
Windows: Download the version for your laptop via https://www.python.org/downloads/
NOTES In your preferred editor, make sure indentation is set to "4 spaces".
- Clone or download repositiory: https://github.com/arevish/palindrome.git
- In source folder, run
python3 'palindrom.py'
to start Next Pallindrome program, optionally, run with--help
argument to see other runtime options. - In source folder, run
python3 'palindromifylist.py'
to start Pallindromify the List program, optionally, run with--help
argument to see other runtime options.