Q. Write a function deleteChar() which takes two parameters-one is a string and the other is a character. The function should create a new string after deleting all occurrences of the character from the string and return the new string.


Answer =


def deleteChar(string, char) :
    str = ""
    for i in string :
        if i == char :
            continue
        else :
            str += i
    return str

 

3 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post