Question: use Python def count_pattern(str, pattern, replace_str): assert len(str) >- len (pattern) # complete the function Complete the above function which takes three string variables as

use Python

 use Python def count_pattern(str, pattern, replace_str): assert len(str) >- len (pattern)

def count_pattern(str, pattern, replace_str): assert len(str) >- len (pattern) # complete the function Complete the above function which takes three string variables as input, and replace all substrings in the first string that matches a given pattern specified by the second input with a given substitute string specified by the last input, and return this updated string as output. For example, count_pattern('shjhfdddedaaba''xyx, 123') returns 's123fdd123a123' as there are three substrings in the first string that match the given pattern: 'hjh', 'ded', 'aba'. Note: You should assume the initial string to be fixed, and create a new string to replace the existing substrings. 5 ptsl

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!