Skip to content

Commit

Permalink
distribute recap questions
Browse files Browse the repository at this point in the history
  • Loading branch information
krother committed Aug 24, 2023
1 parent 8f57684 commit 05293c5
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 354 deletions.
9 changes: 8 additions & 1 deletion data_structures/dictionaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,11 @@ Unfortunately, it contains **three bugs**. Find and fix them.
location = input("Where would you like to travel?")

print("You have reached your destination")


----

### Reflection Questions

* How can you create a dictionary?
* How can you modify values in a dictionary?
* Is it possible to run a for loop over a dictionary?
24 changes: 16 additions & 8 deletions data_structures/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ However, Python is counting differently than humans:

----

### Exercise 1
## Exercise 1

Try a few commands for creating lists:

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

----

### Exercise 2: Indexing
## Exercise 2: Indexing

What do the following commands result in?

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

----

### Exercise 3: Slicing
## Exercise 3: Slicing

What do the following commands result in?

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

----

### Exercise 4: List syntax
## Exercise 4: List syntax

Which instructions are correct?

Expand All @@ -80,7 +80,7 @@ Which instructions are correct?

----

### Exercise 5: List methods
## Exercise 5: List methods

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

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

----

### Exercise 6: Puzzle
## Exercise 6: Puzzle

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

![list funcs exercise2](list_funcs2.png)

----

### Exercise 7: Another puzzle
## Exercise 7: Another puzzle

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

![list funcs exercise1](list_funcs1.png)

---

### Exercise 8: Movie initials
## Exercise 8: Movie initials

Create a list that contains names of movies.
Write a `for` loop that iterates through the movie names.
Expand All @@ -120,3 +120,11 @@ your program should output
S
S
R

----

## Reflection Questions

* How can you create a list?
* How can you modify a single value in a list?
* Is it possible to run a for loop over a list?
45 changes: 41 additions & 4 deletions data_structures/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

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

### Exercise 1: Indexing and slicing strings
## Exercise 1: Indexing and slicing strings

What do the following expressions result in?

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

----

### Exercise 2: Decypher
## Exercise 2: Decypher

The following text contains an encrypted word:

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

----

### Exercise 3: String methods
## Exercise 3: String methods

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

![string exercise](strings.png)

----

### Exercise 4: String parsing
## Exercise 4: String parsing

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

Expand All @@ -49,3 +49,40 @@ Store all the first characters of every name in a new string.
Emilia
Florin
"""

----

## Recap: String manipulation

Fill in the blanks so that the assertions pass

s = "Hello"

# 1. Concatenate the string
...
assert s == "Hello World"

# 2. Convert the string to upper case
...
assert s == "HELLO WORLD"

# 3. Exract the first word
...
assert s == "HELLO"

# 4. Capitalize the string
...
assert s == "Hello"

# 5. Substitute characters
...
assert s == "Hero"


----

## Reflection questions

* Can you modify a string?
* Is there a difference between single-quoted and triple-quoted strings?
* What characters start with a backslash?
9 changes: 9 additions & 0 deletions first_steps/hello.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,12 @@ Exercise 7
~~~~~~~~~~

Write a program that asks for your first and last name and outputs both.

----

Reflection questions
~~~~~~~~~~~~~~~~~~~~

* What can you put inside the brackets of the `print()` function?
* What are legal/illegal variable names?
* What can you do if your program does not work?
5 changes: 3 additions & 2 deletions first_steps/installing_python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ Type:
Reflection Questions
~~~~~~~~~~~~~~~~~~~~

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

.. |image0| image:: spyder.png

8 changes: 8 additions & 0 deletions first_steps/python_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,11 @@ Hints:

.. |image0| image:: calculator.png

----

Reflection Questions
~~~~~~~~~~~~~~~~~~~~

* What does the `=` operator do?
* Do you have to initialize every variable before using it?
* How can you swap the values of two variables?
2 changes: 1 addition & 1 deletion index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Examples of common Python commands
.. toctree::
:maxdepth: 1

reference/python_shell.rst
reference/ipython_shell.rst
reference/basics.rst
reference/data_types.rst
reference/numbers.rst
Expand Down
Loading

0 comments on commit 05293c5

Please sign in to comment.