Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My homework #291

Open
Gitfixing opened this issue Jul 6, 2023 · 0 comments
Open

My homework #291

Gitfixing opened this issue Jul 6, 2023 · 0 comments

Comments

@Gitfixing
Copy link

Gitfixing commented Jul 6, 2023

def is_palindrome(string):
reversed_string = string[::-1]
if string == reversed_string:
return True
else:
return False

Функция is_palindrome принимает строку string и создает обратную ей строку reversed_string с помощью среза [::-1]. Затем она сравнивает исходную строку с обратной и возвращает True, если они равны, и False, если они не равны.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant