C2_W3 UNQ_8 count_n_grams()

My implementation is perfect but I am only able to pass 5 out of the 6 test cases.

Somehow there is a bigram in my trigrams

1 Like

This strongly suggests your implementation is not perfect.

1 Like

I implemented just as it was taught in the course. Can you please look at the code, and tell me where I went wrong

No, I cannot do that. I am not a mentor for that course.

just as tip … for i in range(len(sentence)-n+1)


I had the same problem. Note that the expected solution asks for ‘-2’ instead of ‘<e>’ and ‘-1’ instead of ‘<s>’. We have a tendency not to read the arguments of the functions and to hard-code everything.( Hope it helps

1 Like