Skip to content

Commit

Permalink
'Graphics' and 'Functions' in draft
Browse files Browse the repository at this point in the history
  • Loading branch information
richelbilderbeek committed Jan 15, 2024
1 parent 77bd41a commit 1b2cc1e
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 1 deletion.
106 changes: 106 additions & 0 deletions docs/afternoon_session/functions.md
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)
43 changes: 43 additions & 0 deletions docs/afternoon_session/graphics.md
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?
2 changes: 1 addition & 1 deletion docs/afternoon_session/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This module introduces the fundamentals of Python programming language.
| 14:00-14:15 | Break |
| 14:15-15:00 | [File IO](files.md), [command line arguments](command_line_arguments.md) |
| 15:00-15:15 | Break |
| 15:15-16:00 | Graphics, functions |
| 15:15-16:00 | [Graphics](graphics.md), [functions](functions.md) |

Link to HackMd: <https://hackmd.io/@dianai/uppmax-intro/>

Expand Down

0 comments on commit 1b2cc1e

Please sign in to comment.