Hello there’s a similar post to this but I am still confused about the C2_W1 assignment 3.2 exercise 9 edit two letters. What are we supposed to do with the switches again? I passed both True or False and still get the same error:
Wrong output type.
Expected: 7130.
Got: 7154.
Wrong output type.
Expected: 14206.
Got: 14351.
18 Tests passed
2 Tests failed
Please let me know, thanks!
Hey @Qingyang_Li,
Welcome, and we are glad that you could become a part of our community
In the function edit_tow_letters
, you receive a parameter allow_switches
. Now, whenever in your implementation, you call the function edit_one_letter
, you just need to pass this allow_switches
to the call. Whatever value will be passed to edit_two_letters
when it will be called, the same value will be passed to edit_one_letter
, and voila, we are done! Let us know if this resolves your issue.
P.S. - You posted this thread in the wrong category. I have moved it to the correct one, using the little pencil icon next to the title.
Cheers,
Elemento
Oh hi thanks for the welcome Elemento, cool name. I play elemental shaman in wow if you know what that is lol.
Well I tried both passing the allow_switches True and False and still get 2 wrong results again. At this point I’ll just look at it as a minor implementation erorr and move on. I do understand what this switch does I think that should be enough.
Also thanks for moving the post to the right spot.
Hey @Qingyang_Li,
Apologies for the delayed response. I am glad you liked the name Can you please check your DM once?
Cheers,
Elemento
Did not work by passing allow_switches to call.
still got 2 test error.
what is the actual troubleshooting here? I’m not able to figure out it.
I solved the problem by applying 2 things:
-
Passing allow_switches argument into edit_one_letter (it is used in the edit_two_letters function logic). It is also necessary to check allow_switches in if-else construction before adding the result of switch_letter to the final set in edit_two_letters.
-
allow_switches should be checked in edit_one_letter as well. If it’s true, then you should apply switch_letter.
So, we should check switch_letter both in edit_one_letter and edit_two_letters.
thanks all , this worked also for me : using “edit_one_letter(word,allow_switches)” in edit_two_letters.