result = False
i = 0
if (len(string) > len(laststring)):
while (i < len(laststring)):
if (string[i+(len(string)-len(laststring))] == laststring[i]):
result = True
else:
result = False
i = i+1
return result
def setup():
string = 'thailand'
laststring = 'and'
assert my_endswith(string, laststring) == True
setup()
ไม่มีความคิดเห็น:
แสดงความคิดเห็น