Verified Commit a6a599fc authored by Renato Alves's avatar Renato Alves 🌱

Add numbers to exercises in section 1

parent 473f5e9f
...@@ -109,7 +109,7 @@ del shopping_list[1] ...@@ -109,7 +109,7 @@ del shopping_list[1]
~~~ ~~~
{: .language-python} {: .language-python}
> ## Shop is closed > ## 1.1. Shop is closed
> >
> ~~~ > ~~~
> shopping_list = ["knife", "pan", "mask"] > shopping_list = ["knife", "pan", "mask"]
...@@ -236,7 +236,7 @@ We are done with the loop ...@@ -236,7 +236,7 @@ We are done with the loop
~~~ ~~~
{: .output} {: .output}
> ## Or else ... > ## 1.2. Or else ...
> >
> Compare: > Compare:
> ~~~ > ~~~
...@@ -304,7 +304,7 @@ will result in: ...@@ -304,7 +304,7 @@ will result in:
~~~ ~~~
{: .output} {: .output}
> ## Dictionaries and sets > ## 1.3. Dictionaries and sets
> >
> Although dictionaries and sets share the syntax notation `{}` > Although dictionaries and sets share the syntax notation `{}`
> they can be distinguished by their content. > they can be distinguished by their content.
...@@ -322,7 +322,7 @@ will result in: ...@@ -322,7 +322,7 @@ will result in:
> {: .solution} > {: .solution}
{: .challenge} {: .challenge}
> ## Common ground > ## 1.4. Common ground
> >
> Calculate the word overlap of 3 sentences. > Calculate the word overlap of 3 sentences.
> Use a for loop such that your code would work with an arbitrary number of sentences. > Use a for loop such that your code would work with an arbitrary number of sentences.
...@@ -678,7 +678,7 @@ We see: ...@@ -678,7 +678,7 @@ We see:
- the `finally` keyword (line 16), which always executes, regardless of what happened. - the `finally` keyword (line 16), which always executes, regardless of what happened.
> ## Fear not the exception > ## 1.5. Fear not the exception
> >
> Training also our ability to identify problems, > Training also our ability to identify problems,
> try to predict what exception, if any, is produced in > try to predict what exception, if any, is produced in
...@@ -827,7 +827,7 @@ We see: ...@@ -827,7 +827,7 @@ We see:
> {: .solution} > {: .solution}
{: .challenge} {: .challenge}
> ## Many ways to err > ## 1.6. Many ways to err
> >
> Returning to our complex example from before, define multiple > Returning to our complex example from before, define multiple
> versions of `complex_function` that run through each of the `except` blocks > versions of `complex_function` that run through each of the `except` blocks
...@@ -972,7 +972,7 @@ Positional arguments: (4, 3, 3, 5) - Keyword arguments: {'name': 'John', 'age': ...@@ -972,7 +972,7 @@ Positional arguments: (4, 3, 3, 5) - Keyword arguments: {'name': 'John', 'age':
~~~ ~~~
{: .output} {: .output}
> ## The pirate function definition > ## 1.7. The pirate function definition
> >
> A simple function definition uses fixed arguments occasionally with default values. > A simple function definition uses fixed arguments occasionally with default values.
> Using `*` and/or `**` define a single function that, given the following inputs: > Using `*` and/or `**` define a single function that, given the following inputs:
...@@ -1019,7 +1019,7 @@ Positional arguments: (4, 3, 3, 5) - Keyword arguments: {'name': 'John', 'age': ...@@ -1019,7 +1019,7 @@ Positional arguments: (4, 3, 3, 5) - Keyword arguments: {'name': 'John', 'age':
> {: .solution} > {: .solution}
{: .challenge} {: .challenge}
> ## The rogue cart > ## 1.8. The rogue cart
> >
> Consider the function: > Consider the function:
> ~~~ > ~~~
...@@ -1184,7 +1184,7 @@ An additional feature of generators is that they allow two-way communication. ...@@ -1184,7 +1184,7 @@ An additional feature of generators is that they allow two-way communication.
Instead of `next(mygen)` you can use `mygen.send()` to send data to the generator. Instead of `next(mygen)` you can use `mygen.send()` to send data to the generator.
Using `.send()` will cause the generator to receive a value and iterate to the next step. Using `.send()` will cause the generator to receive a value and iterate to the next step.
> ## Yield or return to battle > ## 1.9. Yield or return to battle
> >
> Is the following definition valid Python? > Is the following definition valid Python?
> What kind of function is it? > What kind of function is it?
...@@ -1214,7 +1214,7 @@ Using `.send()` will cause the generator to receive a value and iterate to the n ...@@ -1214,7 +1214,7 @@ Using `.send()` will cause the generator to receive a value and iterate to the n
> {: .solution} > {: .solution}
{: .challenge} {: .challenge}
> ## Yield back > ## 1.10. Yield back
> >
> While making use of the `back_and_forth` generator but without modifying its source, > While making use of the `back_and_forth` generator but without modifying its source,
> modify the following code to print multiples of 2, on screen, one per line, > modify the following code to print multiples of 2, on screen, one per line,
...@@ -1418,7 +1418,7 @@ OMG! I have received A MESSAGE!!! ...@@ -1418,7 +1418,7 @@ OMG! I have received A MESSAGE!!!
~~~ ~~~
{: .output} {: .output}
> ## With great power... comes extra caution > ## 1.11. With great power... comes extra caution
> >
> When working with files, you may have been introduced to the `open()` function and the `with` keyword. > When working with files, you may have been introduced to the `open()` function and the `with` keyword.
> Together they ensure that, once the `with` block finishes, > Together they ensure that, once the `with` block finishes,
...@@ -1508,7 +1508,7 @@ which creates a file `new_<filename>.csv` for every `<filename>.csv` file in the ...@@ -1508,7 +1508,7 @@ which creates a file `new_<filename>.csv` for every `<filename>.csv` file in the
- [`itertools.*`][itertools-module] - a collection of functions that implement efficient algorithms on top of iterators/generators for good resource management - [`itertools.*`][itertools-module] - a collection of functions that implement efficient algorithms on top of iterators/generators for good resource management
- [`functools.*`][functools-module] - a collection of functions that take as inputs other functions. - [`functools.*`][functools-module] - a collection of functions that take as inputs other functions.
> ## Maintaining order > ## 1.12. Maintaining order
> >
> Correct the following code such that it produces the expected output: > Correct the following code such that it produces the expected output:
> >
...@@ -1557,7 +1557,7 @@ which creates a file `new_<filename>.csv` for every `<filename>.csv` file in the ...@@ -1557,7 +1557,7 @@ which creates a file `new_<filename>.csv` for every `<filename>.csv` file in the
> {: .solution} > {: .solution}
{: .challenge} {: .challenge}
> ## Collections counter > ## 1.13. Collections counter
> >
> Use a dictionary, and `collections.defaultdict` and `collections.Counter` > Use a dictionary, and `collections.defaultdict` and `collections.Counter`
> to count the number of unique strings in the following list of strings > to count the number of unique strings in the following list of strings
......
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