Hello, I’m looking for some help in this loop.
def common_letters(string_one, string_two):
for a in string_one:
if a in string_two: common_characters.append(a) return common_characters
This is my code.
My output is [ ‘a’ ] .
What I was expecting was that the loop would go through each character of string_one, ‘allison’, evaluate that each character is in string_two, also ‘allison’, and then add each character to the empty list common_characters.
It seems to work for the first letter and then stops. Please show me the error of my ways!