Question: 5 points Status: Not Submitted - def remove_all_from_string(word, letter): for i in word: if i == letter: num = word.find(letter) word = word[:num] + word[num+1:]

 5 points Status: Not Submitted - def remove_all_from_string(word, letter): for i

5 points Status: Not Submitted - def remove_all_from_string(word, letter): for i in word: if i == letter: num = word.find(letter) word = word[:num] + word[num+1:] print word print remove_all_from_string("hello", "1") Write a function called remove_all_from_string that takes two strings, and returns a copy of the first string with all instances of the second string removed. You can assume that the second string is only one letter, like "a". Test your function on the strings "hello" and "1". Print the result, which should be: heo You must use: A function definition with parameters. A while loop. The find method. Slicing and the + operator. A return statement

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!