Hi all, I read the posts to this thread, and I now understand how to program the solution to second part of this exercise. Thank you!
However, I still do not understand why the code that I wrote does not work. My solution is not very concise nor elegant, but I would really appreciate it if someone could explain to me why I get an infinite loop when I run it. Here is my code:
def remove_repeats(lst): index1 = len(lst) - 1 while index1 >= 0: index2 = 0 while index2 < len(lst) - 1: if index2 != index1 and lst[index2] == lst[index1]: lst.remove(lst[index2]) index2 += 1 print("Index2 is: " + str(index2)) index1 -= 1 print("Index1 is: " + str(index1)) print(lst) return lst def common_letters(string_one, string_two): common =  for char in string_two: if char in string_one: common.append(char) print(common) new_common = remove_repeats(common) return new_common common_letters('manhattan', 'san francisco')