May-08-2019, 06:56 AM
How can I Implement palindromes in Python?
Palindromes in Python
|
May-08-2019, 06:56 AM
How can I Implement palindromes in Python?
May-08-2019, 07:02 AM
(May-08-2019, 06:56 AM)karansingh Wrote: How can I Implement palindromes in Python?what exactly do you want to achieve? and a bit of friendly advice - when you ask questions, better take part in the following discussion and acknowledge the answers you get.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link Create MCV example Debug small programs
May-08-2019, 07:17 AM
A palindrome is a word, which is reversed order, the same word.
Example: Anna == annA When you write the program, you need first to lower or upper all chars. Otherwise there will be differences in upper/lower case, if you reverse the word. What you need, is just the original word -> lower -> reverse (a new string) > compare it To reverse a string, you can use the square brackets. There is also a built-in function reversed ,but this function returns a reversed object. This is more interesting for sequences/collections, but not for strings. Just look here: https://www.oreilly.com/learning/how-do-...-in-python
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians! |
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
![]() |
Help with Python - Palindromes | SantiagoPB | 4 | 3,218 |
Apr-04-2021, 06:09 PM Last Post: buran |
What are Palindromes in Python? | HarshaliPatel | 5 | 4,878 |
Dec-11-2018, 07:24 AM Last Post: himanibansal |