From a8e860064fe48142864d0900bb5f48640c2a16be Mon Sep 17 00:00:00 2001
From: Blaise Li <blaise.li__git@nsup.org>
Date: Wed, 15 Jun 2022 12:18:09 +0200
Subject: [PATCH] Syncing with exercises in the main course support.

---
 source/Control_Flow_Statements.rst | 65 +++++++++++++++++++++++++-----
 1 file changed, 55 insertions(+), 10 deletions(-)

diff --git a/source/Control_Flow_Statements.rst b/source/Control_Flow_Statements.rst
index a2c3263..c7ead0b 100644
--- a/source/Control_Flow_Statements.rst
+++ b/source/Control_Flow_Statements.rst
@@ -18,7 +18,7 @@ The Fibonacci sequence are the numbers in the following integer sequence:
 
     0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, ...
 
-By definition, the first two numbers in the Fibonacci sequence are 0 and 1, 
+By definition, the first two numbers in the Fibonacci sequence are 0 and 1,
 and each subsequent number is the sum of the previous two.
 The Fibonacci suite can be defined as following:
 
@@ -26,8 +26,8 @@ The Fibonacci suite can be defined as following:
 |    
 |    F\ :sub:`n` = F\ :sub:`n-1` + F\ :sub:`n-2`
 
-Write a function which take an integer ``n`` as parameter
-and returns a list containing the ``n`` first number of the Fibonacci sequence. 
+Write a function that takes an integer ``n`` as parameter
+and returns a list containing the ``n`` first numbers of the Fibonacci sequence.
 
 
 .. literalinclude:: _static/code/fibonacci_iteration.py
@@ -42,18 +42,18 @@ We will see another way more elegant to implement the Fibonacci suite in :ref:`A
 Exercise
 --------
 
-Reimplement your own function max (my_max).
-This function will take a list or tuple of float or integer and 
-returns the largest element?
+Reimplement your own function ``max`` (call it ``my_max``).
+This function will take a list or tuple of floats or integers and
+return the largest element.
 
-Write the pseudocode before to propose an implementation.
+Write the pseudocode before proposing an implementation.
 
 pseudocode
 ^^^^^^^^^^
 
 | *function my_max(l)*
 |   *max <- first elt of l*
-|   *for each elts of l*
+|   *for each elt of l*
 |       *if elt is > max*
 |       *max <- elt*
 |   *return max*
@@ -80,6 +80,51 @@ implementation
    58
 
 
+Exercise
+--------
+
+We want to create a "restriction map" of two sequences.
+
+Create the following enzymes::
+
+   ecor1 = ("EcoRI", "Ecoli restriction enzime I", "gaattc", 1, "sticky")
+   ecor5 = ("EcoRV", "Ecoli restriction enzime V", "gatatc", 3, "blunt")
+   bamh1 = ("BamHI", "type II restriction endonuclease from Bacillus amyloliquefaciens", "ggatcc", 1, "sticky")
+   hind3 = ("HindIII", "type II site-specific nuclease from Haemophilus influenzae", "aagctt", 1, "sticky")
+   taq1 = ("TaqI", "Thermus aquaticus", "tcga", 1, "sticky")
+   not1 = ("NotI", "Nocardia otitidis", "gcggccgc", 2, "sticky")
+   sau3a1 = ("Sau3aI", "Staphylococcus aureus", "gatc", 0, "sticky")
+   hae3 = ("HaeIII", "Haemophilus aegyptius", "ggcc", 2, "blunt")
+   sma1 = ("SmaI", "Serratia marcescens", "cccggg", 3, "blunt")
+
+Then create the following two DNA fragments::
+
+   dna_1 = """tcgcgcaacgtcgcctacatctcaagattcagcgccgagatccccgggggtt
+   gagcgatccccgtcagttggcgtgaattcagcagcagcgcaccccgggcgtagaattccagtt
+   gcagataatagctgatttagttaacttggatcacagaagcttccagaccaccgtatggatccc
+   aacgcactgttacggatccaattcgtacgtttggggtgatttgattcccgctgcctgccagg"""
+
+   dna_2 = """gagcatgagcggaattctgcatagcgcaagaatgcggccgcttagagcgatg
+   ctgccctaaactctatgcagcgggcgtgaggattcagtggcttcagaattcctcccgggagaa
+   gctgaatagtgaaacgattgaggtgttgtggtgaaccgagtaagagcagcttaaatcggagag
+   aattccatttactggccagggtaagagttttggtaaatatatagtgatatctggcttg"""
+
+* In a file <my_file.py>
+#. Create a function *one_line_dna* that transforms a multi-line sequence into a single-line DNA sequence.
+#. Create a collection containing all enzymes
+#. Create a function that takes two parameters:
+
+   #. a sequence of DNA
+   #. a list of enzyme
+   
+   and returns a collection containing the enzymes which cut the DNA.
+   
+Which enzymes cut:
+
+* ``dna_1``?
+* ``dna_2``?
+* ``dna_1`` but not ``dna_2``?
+
 .. _enzyme_exercise:
 
 Exercise
@@ -87,7 +132,7 @@ Exercise
 
 | We want to establish a restriction map of a sequence.
 | But we will do this step by step,
-| and reuse the enzymes used in previous chapter:
+| and reuse the enzymes used in the previous exercise:
 
 * Create a function that takes a sequence and an enzyme as parameters, and returns
    the position of the first binding site.
@@ -97,7 +142,7 @@ Exercise
 
 | *function one_enz_binding_site(dna, enzyme)*
 |     *if enzyme binding site is substring of dna*
-|          *return of first position of substring in dna*
+|          *return first position of substring in dna*
 
 **implementation**
 
-- 
GitLab