I want to do a function in python that takes 2 strings, and compare the positions. In case they are equal ('a' == 'a') it appends to a list True, and if it's not False. Also if there are more positions in a list, it should return False too.
def g22(S1, S2):
new = []
if len(S1) > len(S2):
for i in range(len(S1)):
if S1[i] == S2[i]:
new.append(True)
elif S1[i] != S2[i]:
new.append(False)
else:
new.append(False)
elif len(S1) < len(S2):
for i in range(len(S1)):
if S1[i] == S2[i]:
new.append(True)
elif S1[i] != S2[i]:
new.append(False)
else:
new.append(False)
return new
This is what i've came up with, but besides thinking it's wrong it's also sloppy.. ideas? Thanks
if.