Get startedGet started for free

Multi-line docstrings

Sometimes single-line docstrings are sufficient, but if your function is more complex or has several arguments, then it is generally a better choice to include a multi-line docstring.

You'll practice this by creating a multi-line docstring for the clean_text() function you made earlier.

This exercise is part of the course

Intermediate Python for Developers

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

def clean_text(text, lower=True):
    # Add a multi-line docstring
    """
    ____
    
    """
    clean_text = text.replace(' ', '_')
    if lower == False:
        return clean_text
    else:
        return clean_text.lower()
Edit and Run Code