Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Fixed the documentation and code for UCL issue #100 #202

Open
wants to merge 2 commits into
base: week06
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions week06/average-squares-example/average_squares/squares.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def average_of_squares(list_of_numbers, list_of_weights=None):
for number, weight
in zip(list_of_numbers, effective_weights)
]
return sum(squares)
return sum(squares)/(len(list_of_numbers))



def convert_numbers(list_of_strings):
Expand All @@ -38,7 +39,7 @@ def convert_numbers(list_of_strings):
Example:
--------
>>> convert_numbers(["4", " 8 ", "15 16", " 23 42 "])
[4, 8, 15, 16]
[4.0, 8.0, 15.0, 16.0, 23.0, 42.0]

"""
all_numbers = []
Expand All @@ -51,8 +52,8 @@ def convert_numbers(list_of_strings):


if __name__ == "__main__":
numbers_strings = ["1","2","4"]
weight_strings = ["1","1","1"]
numbers_strings = ["2","4"]
weight_strings = ["1","0.5"]

numbers = convert_numbers(numbers_strings)
weights = convert_numbers(weight_strings)
Expand Down
20 changes: 20 additions & 0 deletions week06/average-squares-example/docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
4 changes: 4 additions & 0 deletions week06/average-squares-example/docs/_build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 16c8507efed606145d536f496f3498e8
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Average Squares Documentation
=============================

.. automodule:: squares
:members:
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. generating_documentation_with_sphinx documentation master file, created by
sphinx-quickstart on Wed Jan 6 22:57:39 2021.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to generating_documentation_with_sphinx's documentation!
================================================================

The purpose of this project is to learn how to write documentation using Sphinx.
The documentation will be on UCL issue #100.
The instructions for how this documentation was created are found in UCL issue #101.

.. toctree::
:maxdepth: 2
:caption: Contents:

content/average-squares-docs.rst


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
Loading