-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
richelbilderbeek
committed
Jan 15, 2024
1 parent
77bd41a
commit 1b2cc1e
Showing
3 changed files
with
150 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Functions | ||
|
||
!!!- info "Learning objectives" | ||
|
||
- Use a for loop | ||
- Write a function without an argument and without a return type | ||
- Write a function that calls a function | ||
- Write a function that requires an argument | ||
- Write a function with a return value | ||
|
||
???- question "For teachers" | ||
|
||
Teaching goals are: | ||
|
||
* Learners have used a for loop | ||
* Learners have written functions | ||
|
||
Lesson plan: | ||
|
||
* 5 mins: prior knowledge | ||
* 5 mins: presentation | ||
* 15 mins: challenge | ||
* 5 mins: feedback | ||
|
||
## Overview | ||
|
||
|
||
## Exercises | ||
|
||
### Exercise 1: using a for loop | ||
|
||
!!!- info "Learning objectives" | ||
|
||
- Use a for loop | ||
|
||
Read the following sections of [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html): | ||
|
||
- 3.2. Instances — a herd of turtles | ||
- 3.3. The for loop | ||
- 3.4. Flow of Execution of the for loop | ||
- 3.5. The loop simplifies our turtle program | ||
|
||
Then do exercise | ||
- 3.8.1 | ||
- 3.8.5 | ||
|
||
### Exercise 2: a simple function | ||
|
||
!!!- info "Learning objectives" | ||
|
||
- Write a function without an argument and without a return type | ||
|
||
Read the following sections of [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html): | ||
|
||
- 4.1. Functions | ||
|
||
Then do exercise: | ||
|
||
- 4.9.1 | ||
|
||
### Exercise 3: write a function that calls a function | ||
|
||
!!!- info "Learning objectives" | ||
|
||
- Write a function that calls a function | ||
|
||
Read the following sections of [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html): | ||
|
||
- 4.2. Functions can call other functions | ||
|
||
Then do exercise: | ||
|
||
- 4.9.2 | ||
|
||
### Exercise 3: write a function that requires an argument | ||
|
||
!!!- info "Learning objectives" | ||
|
||
- Write a function that requires an argument | ||
|
||
Read the following sections of [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html): | ||
|
||
- 4.4. Functions that require arguments | ||
|
||
Then do exercise: | ||
|
||
- 4.9.3 | ||
|
||
### Exercise 4: write a function with a return value | ||
|
||
!!!- info "Learning objectives" | ||
|
||
- Write a function with a return value | ||
|
||
Read the following sections of [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html): | ||
|
||
- 4.5. Functions that return values | ||
|
||
Then do exercise: | ||
|
||
- 4.9.7 | ||
- 4.9.8 | ||
|
||
## Links | ||
|
||
* [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Graphics | ||
|
||
!!!- info "Learning objectives" | ||
|
||
- Make a first scatter plot | ||
- Rehearse running a script that uses an import | ||
- Rehearse that graphics need X-forwarding | ||
|
||
???- question "For teachers" | ||
|
||
Teaching goals are: | ||
|
||
* Learners hear about matplotlib | ||
* Learners may find out again that X-forwarding is important | ||
* Learners again have gotten 'stuff to work' | ||
|
||
Lesson plan: | ||
|
||
* 5 mins: prior knowledge | ||
* 5 mins: presentation | ||
* 15 mins: challenge | ||
* 5 mins: feedback | ||
|
||
## Overview | ||
|
||
Sometimes one wants to make a plot, such like a scatterplot or barchart. | ||
Matplotlib is a popular Python package to make plots. | ||
Here we experience how easy/hard it is to use Matplotlib on Rackham. | ||
|
||
## Exercises | ||
|
||
### Exercise 1: Use matplotlib to show a plot | ||
|
||
!!!- info "Learning objectives" | ||
|
||
- Make a first scatter plot | ||
- Rehearse running a script that uses an import | ||
- Rehearse that graphics need X-forwarding | ||
|
||
Read matplotlib's 'Pyplot tutorial' [here](https://matplotlib.org/stable/tutorials/pyplot.html#sphx-glr-tutorials-pyplot-py). | ||
|
||
Copy-paste the first script on that page to a script and get it to work. | ||
Do you expect this to be easy? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters