Skip to main content Svelte Highlight v7.21.1

reStructuredText language preview

1. Sphinx documentation page

section titles, directives, and inline roles
horizon-dark
Fibonacci Sequence
===================

This module computes the *Fibonacci sequence* using **dynamic programming**.

.. code-block:: python

   def fib(n):
       a, b = 0, 1
       for _ in range(n):
           a, b = b, a + b
       return a

See :func:`fib` for the implementation, or read more at
`Wikipedia <https://en.wikipedia.org/wiki/Fibonacci_sequence>`_.

.. note::

   This implementation runs in O(n) time and O(1) space.
atom-one-dark
Fibonacci Sequence
===================

This module computes the *Fibonacci sequence* using **dynamic programming**.

.. code-block:: python

   def fib(n):
       a, b = 0, 1
       for _ in range(n):
           a, b = b, a + b
       return a

See :func:`fib` for the implementation, or read more at
`Wikipedia <https://en.wikipedia.org/wiki/Fibonacci_sequence>`_.

.. note::

   This implementation runs in O(n) time and O(1) space.
github-dark
Fibonacci Sequence
===================

This module computes the *Fibonacci sequence* using **dynamic programming**.

.. code-block:: python

   def fib(n):
       a, b = 0, 1
       for _ in range(n):
           a, b = b, a + b
       return a

See :func:`fib` for the implementation, or read more at
`Wikipedia <https://en.wikipedia.org/wiki/Fibonacci_sequence>`_.

.. note::

   This implementation runs in O(n) time and O(1) space.
dracula
Fibonacci Sequence
===================

This module computes the *Fibonacci sequence* using **dynamic programming**.

.. code-block:: python

   def fib(n):
       a, b = 0, 1
       for _ in range(n):
           a, b = b, a + b
       return a

See :func:`fib` for the implementation, or read more at
`Wikipedia <https://en.wikipedia.org/wiki/Fibonacci_sequence>`_.

.. note::

   This implementation runs in O(n) time and O(1) space.
nord
Fibonacci Sequence
===================

This module computes the *Fibonacci sequence* using **dynamic programming**.

.. code-block:: python

   def fib(n):
       a, b = 0, 1
       for _ in range(n):
           a, b = b, a + b
       return a

See :func:`fib` for the implementation, or read more at
`Wikipedia <https://en.wikipedia.org/wiki/Fibonacci_sequence>`_.

.. note::

   This implementation runs in O(n) time and O(1) space.
github
Fibonacci Sequence
===================

This module computes the *Fibonacci sequence* using **dynamic programming**.

.. code-block:: python

   def fib(n):
       a, b = 0, 1
       for _ in range(n):
           a, b = b, a + b
       return a

See :func:`fib` for the implementation, or read more at
`Wikipedia <https://en.wikipedia.org/wiki/Fibonacci_sequence>`_.

.. note::

   This implementation runs in O(n) time and O(1) space.

2. Docstring with field list

param/type/returns fields, bullet lists, and literals
horizon-dark
Compute the nth Fibonacci number.

:param n: index into the sequence, zero-based
:type n: int
:returns: the nth Fibonacci number
:rtype: int
:raises ValueError: if n is negative

Example usage:

- Call with ``n=0`` to get the first number
- Call with ``n=10`` to get the eleventh number

.. warning::

   Large values of n may overflow.
atom-one-dark
Compute the nth Fibonacci number.

:param n: index into the sequence, zero-based
:type n: int
:returns: the nth Fibonacci number
:rtype: int
:raises ValueError: if n is negative

Example usage:

- Call with ``n=0`` to get the first number
- Call with ``n=10`` to get the eleventh number

.. warning::

   Large values of n may overflow.
github-dark
Compute the nth Fibonacci number.

:param n: index into the sequence, zero-based
:type n: int
:returns: the nth Fibonacci number
:rtype: int
:raises ValueError: if n is negative

Example usage:

- Call with ``n=0`` to get the first number
- Call with ``n=10`` to get the eleventh number

.. warning::

   Large values of n may overflow.
dracula
Compute the nth Fibonacci number.

:param n: index into the sequence, zero-based
:type n: int
:returns: the nth Fibonacci number
:rtype: int
:raises ValueError: if n is negative

Example usage:

- Call with ``n=0`` to get the first number
- Call with ``n=10`` to get the eleventh number

.. warning::

   Large values of n may overflow.
nord
Compute the nth Fibonacci number.

:param n: index into the sequence, zero-based
:type n: int
:returns: the nth Fibonacci number
:rtype: int
:raises ValueError: if n is negative

Example usage:

- Call with ``n=0`` to get the first number
- Call with ``n=10`` to get the eleventh number

.. warning::

   Large values of n may overflow.
github
Compute the nth Fibonacci number.

:param n: index into the sequence, zero-based
:type n: int
:returns: the nth Fibonacci number
:rtype: int
:raises ValueError: if n is negative

Example usage:

- Call with ``n=0`` to get the first number
- Call with ``n=10`` to get the eleventh number

.. warning::

   Large values of n may overflow.

3. Lists and substitutions

numbered/bulleted lists, substitutions, and hyperlink targets
horizon-dark
Installation
============

Requirements:

1. Python |python_version| or newer
#. A virtual environment
#. pip installed

.. |python_version| replace:: 3.10

Steps:

* Create a virtual environment
* Activate it
* Run ``pip install mymodule``

.. _mymodule: https://pypi.org/project/mymodule/
atom-one-dark
Installation
============

Requirements:

1. Python |python_version| or newer
#. A virtual environment
#. pip installed

.. |python_version| replace:: 3.10

Steps:

* Create a virtual environment
* Activate it
* Run ``pip install mymodule``

.. _mymodule: https://pypi.org/project/mymodule/
github-dark
Installation
============

Requirements:

1. Python |python_version| or newer
#. A virtual environment
#. pip installed

.. |python_version| replace:: 3.10

Steps:

* Create a virtual environment
* Activate it
* Run ``pip install mymodule``

.. _mymodule: https://pypi.org/project/mymodule/
dracula
Installation
============

Requirements:

1. Python |python_version| or newer
#. A virtual environment
#. pip installed

.. |python_version| replace:: 3.10

Steps:

* Create a virtual environment
* Activate it
* Run ``pip install mymodule``

.. _mymodule: https://pypi.org/project/mymodule/
nord
Installation
============

Requirements:

1. Python |python_version| or newer
#. A virtual environment
#. pip installed

.. |python_version| replace:: 3.10

Steps:

* Create a virtual environment
* Activate it
* Run ``pip install mymodule``

.. _mymodule: https://pypi.org/project/mymodule/
github
Installation
============

Requirements:

1. Python |python_version| or newer
#. A virtual environment
#. pip installed

.. |python_version| replace:: 3.10

Steps:

* Create a virtual environment
* Activate it
* Run ``pip install mymodule``

.. _mymodule: https://pypi.org/project/mymodule/