https://github.com/paparascal2020/expansive-code-kata-python
A port of my PHP code Kata to Python
https://github.com/paparascal2020/expansive-code-kata-python
Last synced: 10 months ago
JSON representation
A port of my PHP code Kata to Python
- Host: GitHub
- URL: https://github.com/paparascal2020/expansive-code-kata-python
- Owner: PapaRascal2020
- Created: 2022-06-24T17:57:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-24T18:13:55.000Z (almost 4 years ago)
- Last Synced: 2025-02-22T05:18:31.403Z (over 1 year ago)
- Language: Python
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Find the longest palindrome in a string
A palindrome is a word, verse, sentence, or number which reads the same backward as it
does forward.
* Only find palindromes of at least 3 characters in length
* If no palindromes are found, return `None`
* If multiple palindromes are found of the same length, return the first found
### For this scenario, we can:
* Ignore any white-space characters in the string
* White-space characters do not need retaining for the output
* Ignore casing in the string
* Uppercase characters can be considered equal to lowercase characters
* Character casing does not need retaining for the output
* Ignore any non-alphanumeric characters, for example, commas.
* Non-alphanumeric characters do not need retaining for the output
* Refer to chosen language documentation
Input (palindromes underlined) | Expected Output
--- | ---
Racecar|racecar
Red rum, sir, is murder|redrumsirismurder
12345|`None`
123acacacb123|acaca
xx|`None`
xxx|xxx
.....x , 1 ?! x......|x1x
aaa bbb ccc|aaa
### Info for running the test
* Install Python3
* CD into Root Directory in the Command Line
* RUN pip install pytest
* RUN python -m pytest tests
You should then see 13 passed the test and 0 failures