Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hub-courses
python_one_week_4_biologists_solutions
Commits
e986fb63
Commit
e986fb63
authored
Jun 08, 2021
by
Blaise Li
Browse files
Typos, formatting.
parent
81af9a1f
Pipeline
#58084
passed with stages
in 12 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
source/Collection_Data_Types.rst
View file @
e986fb63
...
...
@@ -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
return
s
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'
#
w
hat is the value of x
?
#
W
hat 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`` w
h
ich reference
s
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 vary
ing
the first base*
| *for each first base let vary
ing
the second base*
| *for each combination first base, second base let vary
ing
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*
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment