Skip to content

Instantly share code, notes, and snippets.

@a1exDi
Last active April 3, 2022 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a1exDi/c8ca078e936f89f2fa78134e338df795 to your computer and use it in GitHub Desktop.
Save a1exDi/c8ca078e936f89f2fa78134e338df795 to your computer and use it in GitHub Desktop.
Проверить, является ли слово или число палиндромом. Готовые функции на python и javascript
function palindrome(word) {
if (word === word.split('').reverse().join('')) {
return true;
} else {
return false;
}
}
def palindrome(word):
if word == word[::-1]:
return True
else:
return False
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