avatar Bite 209. Write a Sphinx docstring

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:


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

Login and get coding
go back Beginner level
Bitecoin 2X

261 out of 266 users completed this Bite.
Will you be Pythonista #262 to crack this Bite?
Resolution time: ~24 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 1.5 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help