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 convert_data_structure 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.

# Create the convert_data_type function
def convert_data_structure(data, data_type="list"):
  # Add a multi-line docstring
  """
  ____
  
  
  	
    
    
  
  	
  """
  if data_type == "tuple":
    data = tuple(data)
  elif data_type == "set":
    data = set(data)
  else:
    data = list(data)
  return data
Edit and Run Code