I’m not sure there is a
remove method, have you tried googling on how to remove a character from a string?
hi, yh I’m doing that now and apparently list.remove(value) removes elements from a list by value however I’ve just read it removes the fiirst instance of that element so if an element value was to repeat itself it would leave it in.
I have developed a function that removes a specific character from a given string and returns a new string that does not have that character. I hope it might help you. Please let me know whether it’s worked or not.
def removevowels(string, charVal): new_str = "" for i in range(0, len(string)): if string[i] != charVal: new_str += string[i] return new_str updatedStr = removevowels("ademola", "a") print(updatedStr)
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.