Skip to content

Commit 05293c5

Browse files
author
Kristian Rother
committed
distribute recap questions
1 parent 8f57684 commit 05293c5

File tree

12 files changed

+156
-354
lines changed

12 files changed

+156
-354
lines changed

data_structures/dictionaries.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,11 @@ Unfortunately, it contains **three bugs**. Find and fix them.
5959
location = input("Where would you like to travel?")
6060

6161
print("You have reached your destination")
62-
62+
63+
----
64+
65+
### Reflection Questions
66+
67+
* How can you create a dictionary?
68+
* How can you modify values in a dictionary?
69+
* Is it possible to run a for loop over a dictionary?

data_structures/lists.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ However, Python is counting differently than humans:
1414

1515
----
1616

17-
### Exercise 1
17+
## Exercise 1
1818

1919
Try a few commands for creating lists:
2020

@@ -34,7 +34,7 @@ Write code to print all the movie names:
3434

3535
----
3636

37-
### Exercise 2: Indexing
37+
## Exercise 2: Indexing
3838

3939
What do the following commands result in?
4040

@@ -48,7 +48,7 @@ What do the following commands result in?
4848

4949
----
5050

51-
### Exercise 3: Slicing
51+
## Exercise 3: Slicing
5252

5353
What do the following commands result in?
5454

@@ -62,7 +62,7 @@ What do the following commands result in?
6262

6363
----
6464

65-
### Exercise 4: List syntax
65+
## Exercise 4: List syntax
6666

6767
Which instructions are correct?
6868

@@ -80,7 +80,7 @@ Which instructions are correct?
8080

8181
----
8282

83-
### Exercise 5: List methods
83+
## Exercise 5: List methods
8484

8585
Find out what each of the expressions does to the list in the center.
8686

@@ -89,23 +89,23 @@ Find out what each of the expressions does to the list in the center.
8989

9090
----
9191

92-
### Exercise 6: Puzzle
92+
## Exercise 6: Puzzle
9393

9494
Use the expressions to modify the list as indicated. Use each expression once.
9595

9696
![list funcs exercise2](list_funcs2.png)
9797

9898
----
9999

100-
### Exercise 7: Another puzzle
100+
## Exercise 7: Another puzzle
101101

102102
Use the expressions to modify the list as indicated. Use each expression once.
103103

104104
![list funcs exercise1](list_funcs1.png)
105105

106106
---
107107

108-
### Exercise 8: Movie initials
108+
## Exercise 8: Movie initials
109109

110110
Create a list that contains names of movies.
111111
Write a `for` loop that iterates through the movie names.
@@ -120,3 +120,11 @@ your program should output
120120
S
121121
S
122122
R
123+
124+
----
125+
126+
## Reflection Questions
127+
128+
* How can you create a list?
129+
* How can you modify a single value in a list?
130+
* Is it possible to run a for loop over a list?

data_structures/strings.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
In this chapter you will store text (**strings**) in variables.
55

6-
### Exercise 1: Indexing and slicing strings
6+
## Exercise 1: Indexing and slicing strings
77

88
What do the following expressions result in?
99

@@ -19,7 +19,7 @@ What do the following expressions result in?
1919

2020
----
2121

22-
### Exercise 2: Decypher
22+
## Exercise 2: Decypher
2323

2424
The following text contains an encrypted word:
2525

@@ -29,15 +29,15 @@ Print every second character, starting with the 2nd).
2929

3030
----
3131

32-
### Exercise 3: String methods
32+
## Exercise 3: String methods
3333

3434
Find out what the expressions do to the string in the middle.
3535

3636
![string exercise](strings.png)
3737

3838
----
3939

40-
### Exercise 4: String parsing
40+
## Exercise 4: String parsing
4141

4242
Store all the first characters of every name in a new string.
4343

@@ -49,3 +49,40 @@ Store all the first characters of every name in a new string.
4949
Emilia
5050
Florin
5151
"""
52+
53+
----
54+
55+
## Recap: String manipulation
56+
57+
Fill in the blanks so that the assertions pass
58+
59+
s = "Hello"
60+
61+
# 1. Concatenate the string
62+
...
63+
assert s == "Hello World"
64+
65+
# 2. Convert the string to upper case
66+
...
67+
assert s == "HELLO WORLD"
68+
69+
# 3. Exract the first word
70+
...
71+
assert s == "HELLO"
72+
73+
# 4. Capitalize the string
74+
...
75+
assert s == "Hello"
76+
77+
# 5. Substitute characters
78+
...
79+
assert s == "Hero"
80+
81+
82+
----
83+
84+
## Reflection questions
85+
86+
* Can you modify a string?
87+
* Is there a difference between single-quoted and triple-quoted strings?
88+
* What characters start with a backslash?

first_steps/hello.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,3 +142,12 @@ Exercise 7
142142
~~~~~~~~~~
143143

144144
Write a program that asks for your first and last name and outputs both.
145+
146+
----
147+
148+
Reflection questions
149+
~~~~~~~~~~~~~~~~~~~~
150+
151+
* What can you put inside the brackets of the `print()` function?
152+
* What are legal/illegal variable names?
153+
* What can you do if your program does not work?

first_steps/installing_python.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ Type:
4343
Reflection Questions
4444
~~~~~~~~~~~~~~~~~~~~
4545

46-
- Which text editors are installed on your system?
47-
- Which Python version are you running?
46+
- Which text editors are installed on your system?
47+
- Which Python version are you running?
48+
- Name some advantages/disadvantages of the Python language
4849

4950
.. |image0| image:: spyder.png
5051

first_steps/python_shell.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,11 @@ Hints:
179179

180180
.. |image0| image:: calculator.png
181181

182+
----
183+
184+
Reflection Questions
185+
~~~~~~~~~~~~~~~~~~~~
186+
187+
* What does the `=` operator do?
188+
* Do you have to initialize every variable before using it?
189+
* How can you swap the values of two variables?

index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Examples of common Python commands
115115
.. toctree::
116116
:maxdepth: 1
117117

118-
reference/python_shell.rst
118+
reference/ipython_shell.rst
119119
reference/basics.rst
120120
reference/data_types.rst
121121
reference/numbers.rst

0 commit comments

Comments
 (0)