0
py_challenge#1.Palindrome string(s)
I recently started learning Python. You only learn it by using it! This is a small task published in GeeksforGeeks. Let's vote for the best solution! Given a string, write a python function to check if it is palindrome or not. A string is said to be palindrome if reverse of the string is same as string. For example, "radar" is palindrome, but "radix" is not palindrome. Examples: Input : malayalam Output : Yes Input : geeks Output : No --from GeeksforGeeks:Python
6 Answers
+ 4
Here is my code:
https://code.sololearn.com/cXsS81iZnqaa/?ref=app
+ 2
Here is mine:
https://code.sololearn.com/cG5xDup6UMO9/#py
+ 2
Hi all, thank you for sharing your codes! Let's set a dealine of Berlin time 0 o' clock this Friday... I am currently trying to design for a unitest, not for sure yet... If I succeed, the finnal performance would be determined by both test and vote. Have fun!
+ 2
Hi, as it is approaching Friday, we are closing this challenge. You all did the work correctly to recognize a Palindrome string. Ulisses used string reverse method, Bang and Bogdan used for loop to solve the issue, and Robin gave an interaction possibillity~ Well done, guys. As I mentioned before, we will chose the one with most votes, so Ulisses you got it! Also, when I think of unitest, I found that my description was quite unclear. So I decide to open a second challenge with it. You are all invited. For a first glance, here is the unitest, not fully done yet though~
https://code.sololearn.com/cDrQgxmyNQB1/?ref=app
+ 1
def is_palindrome(str):
return (not (False in [str[i]==str[-i-1] for i in range(len(str)//2)]))
Yes, this could be solved in simpler ways, but this is the beauty of programming - finding interesting new ways of solving things :)
+ 1
just check my code so efficient and logical:
https://code.sololearn.com/cVSjBfmAg16M/?ref=app