Find Python specific character locations

Asked 1 weeks ago, Updated 1 weeks ago, 1 views

No errors appear in the first sentence, but errors appear in the second sentence. I've done it and I've got a value of 9, so where is there a mistake?


2022-09-20 10:54

1 Answers


In a normal scenario, the IDx value increases by 1 from the position and returns idx when the character you are looking for is found. However, the code of the text seems to be idx and the code for finding letters.

I received a position as a parameter, but the search does not start with a position, but starts with the first character through the in syntax.

For idx, the 5 entered as position is substituted, and the repetitive sentence looks for o from the first letter. The value of idx will increase by expression 1, starting with 5, and eventually find hello and add 4. The reason why the result is 9.

Ask the part that makes a mistake, so I just point out the part that makes a point out the part that makes a mistake. Fighting

2022-09-20 10:54

If you have any answers or tips

© 2022 pinfo. All rights reserved.