C2_W1_Assignment insert_letter expected result has 2 duplicates

Hi, I assume duplicates are allowed in the insert_letter function. Please confirm
Quote :" Expected output

Input word at 
split_l = [('', 'at'), ('a', 't'), ('at', '')] 
insert_l = ['aat', 'bat', 'cat', 'dat', 'eat', 'fat', 'gat', 'hat', 'iat', 'jat', 'kat', 'lat', 'mat', 'nat', 'oat', 'pat', 'qat', 'rat', 'sat', 'tat', 'uat', 'vat', 'wat', 'xat', 'yat', 'zat', 'aat', 'abt', 'act', 'adt', 'aet', 'aft', 'agt', 'aht', 'ait', 'ajt', 'akt', 'alt', 'amt', 'ant', 'aot', 'apt', 'aqt', 'art', 'ast', 'att', 'aut', 'avt', 'awt', 'axt', 'ayt', 'azt', 'ata', 'atb', 'atc', 'atd', 'ate', 'atf', 'atg', 'ath', 'ati', 'atj', 'atk', 'atl', 'atm', 'atn', 'ato', 'atp', 'atq', 'atr', 'ats', 'att', 'atu', 'atv', 'atw', 'atx', 'aty', 'atz']
Number of strings output by insert_letter('at') is 78
```(there are  'aat' and 'att' twice

Hi @Vasili_Reikh

Yes, you are right, they are allowed. That is because after all the edits we use set() (in edit_one_letter function). The logic behind it is that we to check for duplicates at the end anyways (for example, switch_letter and replace_letter can produce duplicates independently and we would have to check for it).
In other words, for simplicity the duplicates are allowed.

Cheers

Thank you, @arvyzukai

Hi @ arvyzukai

The problem is that the unit test fails when the function correctly returns no duplicates. Please see the code and test results below and note that, as Vasili mentions above, aat and att are duplicated in the expected test results.
Thanks!

CODE:
split_l = [(word[:i], word[i:]) for i in range(len(word) + 1)]
insert_set = set()
for i in range(len(letters)):
insert_set.update([L + letters[i] + R for (L,R) in split_l])

insert_l = sorted(list(insert_set))

TEST RESULTS:

Test your function

w1_unittest.test_insert_letter(insert_letter)
Output list do not have the expected number of elements.
Expected: 78.
Got: 76.
Wrong output values.
Expected: [‘aat’, ‘bat’, ‘cat’, ‘dat’, ‘eat’, ‘fat’, ‘gat’, ‘hat’, ‘iat’, ‘jat’, ‘kat’, ‘lat’, ‘mat’, ‘nat’, ‘oat’, ‘pat’, ‘qat’, ‘rat’, ‘sat’, ‘tat’, ‘uat’, ‘vat’, ‘wat’, ‘xat’, ‘yat’, ‘zat’, ‘aat’, ‘abt’, ‘act’, ‘adt’, ‘aet’, ‘aft’, ‘agt’, ‘aht’, ‘ait’, ‘ajt’, ‘akt’, ‘alt’, ‘amt’, ‘ant’, ‘aot’, ‘apt’, ‘aqt’, ‘art’, ‘ast’, ‘att’, ‘aut’, ‘avt’, ‘awt’, ‘axt’, ‘ayt’, ‘azt’, ‘ata’, ‘atb’, ‘atc’, ‘atd’, ‘ate’, ‘atf’, ‘atg’, ‘ath’, ‘ati’, ‘atj’, ‘atk’, ‘atl’, ‘atm’, ‘atn’, ‘ato’, ‘atp’, ‘atq’, ‘atr’, ‘ats’, ‘att’, ‘atu’, ‘atv’, ‘atw’, ‘atx’, ‘aty’, ‘atz’].
Got: [‘aat’, ‘abt’, ‘act’, ‘adt’, ‘aet’, ‘aft’, ‘agt’, ‘aht’, ‘ait’, ‘ajt’, ‘akt’, ‘alt’, ‘amt’, ‘ant’, ‘aot’, ‘apt’, ‘aqt’, ‘art’, ‘ast’, ‘ata’, ‘atb’, ‘atc’, ‘atd’, ‘ate’, ‘atf’, ‘atg’, ‘ath’, ‘ati’, ‘atj’, ‘atk’, ‘atl’, ‘atm’, ‘atn’, ‘ato’, ‘atp’, ‘atq’, ‘atr’, ‘ats’, ‘att’, ‘atu’, ‘atv’, ‘atw’, ‘atx’, ‘aty’, ‘atz’, ‘aut’, ‘avt’, ‘awt’, ‘axt’, ‘ayt’, ‘azt’, ‘bat’, ‘cat’, ‘dat’, ‘eat’, ‘fat’, ‘gat’, ‘hat’, ‘iat’, ‘jat’, ‘kat’, ‘lat’, ‘mat’, ‘nat’, ‘oat’, ‘pat’, ‘qat’, ‘rat’, ‘sat’, ‘tat’, ‘uat’, ‘vat’, ‘wat’, ‘xat’, ‘yat’, ‘zat’].

Hi @AaronSz

Excellent point! :+1: The issue will be addressed.

Thank you for pointing that out.