Question: Please complete the code below: ######################################### # Task 1: Complete this function # change_str_multi(in_string:str, change_char:str, replace_char:str) -> str: # ################################ def change_str_multi(in_string, change_char, replace_char): #

 Please complete the code below: ######################################### # Task 1: Complete thisfunction # change_str_multi(in_string:str, change_char:str, replace_char:str) -> str: # ################################ def change_str_multi(in_string, change_char,replace_char): # # your code goes here # return None # fix

Please complete the code below:

######################################### # Task 1: Complete this function # change_str_multi(in_string:str, change_char:str, replace_char:str) -> str: # ################################ def change_str_multi(in_string, change_char, replace_char): # # your code goes here # return None # fix this

######################################### # Task 2: Complete this function # change_str_single(in_string:str, change_char:str, replace_char:str) -> str: ######################################### def change_str_single(in_string, change_char, replace_char): # # your code goes here # return None # fix this

######################################### # Task 3: Complete this function # change_str(in_string:str, change_num:int, change_char:str, replace_char:str) -> str: ######################################### def change_str(in_string, change_num, change_char, replace_char): # # your code goes here # return None # fix this ####################################################################### # NOTE: # The code below is provided for you during development and testing # Your code will be tested with unit tests that DO NOT use the code below ####################################################################### if __name__ == '__main__': orig_string = 'distilling instilling fulfilling' multi_string = change_str_multi(orig_string, 'i', '*') print(f'Multi: {multi_string}') single_string = change_str_single(orig_string, 'i', '*') print(f'Single: {single_string}') num_string = change_str(orig_string, 2, 'i', '*') print(f'Single: {single_string}')

The tasks below are provided to give an example of the sorts of tasks you might be asked in the Programming Challenge. Please note the following: - Below THREE tasks are listed and typically there would be THREE to FOUR such tasks for each Challenge Questions - NO TESTS have been set up. You should run in develop mode and think about what inputs could be used in the unit tests - some examples are shown in the __ main_ provided - Skeleton functions are included and show where your code is required Task 1 Implement the Python function change_str_multi(in_string: str, change_char: str, replace_char: str) str. Details are as follows: - The function is input - a str, named in_string - a str (of length 1), named change_char - a str (of length 1), named replace_char - The function replaces all occurrences of change_char in in_string with replace_char - The function returns the resulting string For example for the following function call: change_string('this is a string for testing', 'i', '*') the function returns the string: dst11ngnst11ng fulf* 11ng Write a Python function change_str_single(in_string: str, change_char:str, replace_char: str) str. Details are as follows: - The function is input - a str, named in_string - a str (of length 1), named change_char - a str (of length 1), named replace_char - The function replaces JUST THE FIRST occurrence of change_char in in_string with replace_char - The function returns the resulting string For example for the following function call: change_str_single('distilling instilling fulfilling', 'i', '*') the function returns the string: 'd*stilling *nstilling fulf*lling' NOTE: if there are no occurrences of change_str in a word then that word is unchanged Write a Python function 'change_str(in_string: str, change_num:int, change_char: str, replace_char: str) -> str. Details are as follows: - The function is input - a str, named in_string - an int, named change_num - a str (of length 1), named change_char - a str (of length 1), named replace_char - The function replaces JUST the single change_num'th occurrence of change_char in in_string with replace_char - The function returns the resulting string For example for the following function call, where change_num is 2 : change_str('distilling instilling fulfilling', 2, 'i', '*') the function returns the string: 'dist*lling inst*lling fulfill*ng' NOTE: if there are no occurrences of change_str in a word then that word is unchanged

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!