I need to make the endswith() function without using the built-in function in Python. I wanted to know if there is any way i could do it shorter and easier? I'm sure there is, my way is really complicated.
string = "example for endswith"
find = "endswith"
l = len(find)
final = False
b = 0
tstring =[]
new = ""
for i in string:
if find[b] == i:
tstring.insert(b,i)
b = b + 1
if b == l:
print(tstring)
break
for x in tstring:
new += x
print(new)
if(new==find):
final = True
print(final)