Question: mines the position in a given string where another string occurs as a ng. For example, the string a occurs in the string abab at
mines the position in a given string where another string occurs as a ng. For example, the string "a" occurs in the string "abab" at positions 0 and 2. The function takes two parameters: str which is the given string and which is the substring to look for. The function returns a list of the positions in str in which occurs. The function is syntactically correct but has four (4) incorrect lines of code which contain logic errors that prevent it from computing correctly. In the following questions, you will choose the answer to the question on particular lines of code - how they should be corrected or whether they are correct as they are remember, only 4 lines are incorrect. Examples of a main program that uses the function, when it is correctly Implemented, and sample output are also provided. Punction to determine positions of a substring in another string def substring(str,s): posns - 0 for 1 in range (lencate) - len(s) :1): Question Answered Question Progress Part 1: Part 1 Part 2 Part 2 Cholce Parts Part done - False while 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
