github-actions
Sync from GitHub
96d64c6
Raw History Blame Contribute Delete
693 Bytes
class StrOps:
@staticmethod
def str_reverse(s: str) -> str:
"""Reverse a string
Args:
s (str): String to reverse
Returns:
str: Reversed string
"""
ret = ""
for i in range(len(s)):
ret += s[len(s) - 1 - i]
return ret
@staticmethod
def palindrome(s: str) -> bool:
"""Check if a string is a palindrome
Args:
s (str): String to check
Returns:
bool: True if the string is a palindrome, False otherwise
"""
for i in range(len(s)):
if s[i] != s[len(s) - 1 - i]:
return False
return True