Why my code will automatic multiple 4?

Hi,I am doing project for stirng method,and i don’t know why my code output will always automatic multiple 4,I already check the answer,but still cannot solve the problem.At the before step,it is still normal that only have one time,but at the second picture,it appears four time,and i really don’t know the reason why.And this the checkpoint 8 in the string methid project.

#string methods

Hello, @jianwei_02, and welcome to the forums!

Generally speaking, (I see you have for loops in your code) if you are getting more of something than you expected to get, you have something inside a loop that shouldn’t be there.

The append statement at line 131 should be in the same indent as the outer loop.

Wow!Thank you very much,i have solved this problem for nearly 1 hour.

1 Like