判断字符串是否为回文串
def is_valid_string(string):
"""
判断是否为回文串
"""
left = 0
rigth = len(string)-1
while (left < rigth):
if (string[left] != string[rigth]):
return False
left += 1
rigth -= 1
return True
my_string = "aba"
result = is_valid_string(my_string)
print(f"result is {result}")