Sobes.tech
Junior — Senior

Create a test for the function that removes the initial substring

livecode

Task condition

There is a function dif_str(source: str, prefix: str) -> str, which removes the string prefix from the beginning of the string source if source indeed starts with prefix.

def dif_str(source: str, prefix: str) -> str:
    if source.startswith(prefix):
        return source.replace(prefix, '')