Pybites Logo

Write a sphinx docstring

Level: Beginner (score: 2)

Your team uses Sphinx and wants you to comply with its standards for docstrings. As per the Sphinx-RTD-Tutorial a typical Sphinx docstring has the following format:

"""[Summary]

:param [ParamName]: [ParamDescription], defaults to [DefaultParamVal]
:type [ParamName]: [ParamType](, optional)
...
:raises [ErrorType]: [ErrorDescription]
...
:return: [ReturnDescription]
:rtype: [ReturnType]
"""

Based on this format and using the literal strings in italics below, write a docstring for sum_numbers that:

  • has Sums numbers for the Summary part,
  • receives numbers: a list of numbers (type: list),
  • raises a TypeError: if not all numeric values passed in,
  • and returns sum of numbers (type: int)

There's no need to implement the function (leave the pass in) as this is about writing the proper docstring.

Note:We will be adding annotations to this function in the next Bite so you will need to complete this Bite to unlock the next.