Last active
April 3, 2022 10:18
-
-
Save a1exDi/c8ca078e936f89f2fa78134e338df795 to your computer and use it in GitHub Desktop.
Проверить, является ли слово или число палиндромом. Готовые функции на python и javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function palindrome(word) { | |
if (word === word.split('').reverse().join('')) { | |
return true; | |
} else { | |
return false; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def palindrome(word): | |
if word == word[::-1]: | |
return True | |
else: | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def palindrome(s): | |
s = "".join([character for character in s.lower() if character.isalnum()]) | |
return s == s[::-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment