I am new to programming and I am trying to figure out this problem. I have a list of elements and I want to find words that have the same length. This is what I've tried:
list1 = ["dog","cat","people","tank","pop","joop","count"]
list3 = []
for i in range(len(list1)):
for j in range(len(list1):
if len(list1[i]) == len(list1[j]):
list3.append(list[i])
return list3
I want to return list3 = [ "dog","cat","joop","tank"]
because each word in this last has the same length as at least one other word in the list.