Commit e986fb63 authored by Blaise Li's avatar Blaise Li
Browse files

Typos, formatting.

parent 81af9a1f
Pipeline #58084 passed with stages
in 12 seconds
......@@ -101,7 +101,7 @@ Exercise
--------
.. note::
``sum`` is a function which return the sum of all the elements of a list.
``sum`` is a function that returns the sum of all the elements of a list.
Wihout using the Python shell, tell what are the effects of the following statements::
......@@ -135,12 +135,12 @@ Here, we compute the mean of the values contained in the list ``x``, after havin
Exercise
--------
Draw the representation in memory of the following expressions. ::
Draw the representation in memory of the ``x`` and ``y`` variables when the following code is executed::
x = [1, ['a','b','c'], 3, 4]
x = [1, ['a', 'b', 'c'], 3, 4]
y = x[1]
y[2] = 'z'
# what is the value of x ?
# What is the value of x?
.. figure:: _static/figs/list_2-1.png
:width: 400px
......@@ -152,7 +152,7 @@ Draw the representation in memory of the following expressions. ::
.. image :: _static/figs/spacer.png
When we execute *y = x[1]*, we create ``y`` wich reference the list ``['a', 'b', 'c']``.
When we execute *y = x[1]*, we create ``y`` which references the list ``['a', 'b', 'c']``.
This list has 2 references on it: ``y`` and ``x[1]`` .
......@@ -185,16 +185,22 @@ from the list l = [1, 2, 3, 4, 5, 6, 7, 8, 9] generate 2 lists l1 containing all
Exercise
--------
generate a list containing all codons.
.. note::
A codon is a triplet of nucleotides.
A nucleotide can be one of the four letters A, C, G, T
Write a function that returns a list containing strings representing all possible codons.
Write the pseudocode before proposing an implementation.
pseudocode:
"""""""""""
| *function all_codons()*
| *all_codons <- empty list*
| *let varying the first base*
| *for each first base let varying the second base*
| *for each combination first base, second base let varying the third base*
| *let vary the first base*
| *for each first base let vary the second base*
| *for each combination first base, second base let vary the third base*
| *add the concatenation base 1 base 2 base 3 to all_codons*
| *return all_codons*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment