Skip to content

Commit

Permalink
Morning session ready
Browse files Browse the repository at this point in the history
  • Loading branch information
richelbilderbeek committed Jan 15, 2024
1 parent 5bedfdb commit e9a890f
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 9 deletions.
5 changes: 3 additions & 2 deletions docs/morning_session/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ This module introduces the fundamentals of Python programming language.
|---------------|-------------------------------|
| 09:00-10:00 | [Using the Python interpreter](using_the_python_interpreter.md) [The way of the program](the_way_of_the_program.md) |
| 10:00-10:15 | Break |
| 10:15-11:00 | [Working with Python scripts](working_with_python_scripts.md), variables|
| 10:15-11:00 | [Working with Python scripts](working_with_python_scripts.md), [variables](variables_expressions_and_statements.md) |
| 11:00-11:15 | Break |
| 11:15-12:00 | Exercises |
| 11:15-12:00 | [Expressions and statements](variables_expressions_and_statements.md), [input](variables_expressions_and_statements.md)
| 12:00-13:00 | Break |
| 13:00-14:00 | Functions and Modules |
| 14:00-14:15 | Break |
| 14:15-15:00 | Command line arguments and IO |
Expand Down
111 changes: 111 additions & 0 deletions docs/morning_session/variables_expressions_and_statements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Variables, expressions and statements

!!!- info "Learning objectives"

* Get the type of an object
* Create a variable
* Use a variable

???- question "For teachers"

Teaching goals are:

* Learners have worked with variables
* Learners understand the purpose of variables
* Learners have obtained the data type of a variable
* Learners have heard about what a data type is

Lesson plan:

Exercise 1:

* 5 mins: prior knowledge
* 5 mins: presentation
* 15 mins: challenge
* 5 mins: feedback

Exercise 2 and 3:

* 5 mins: prior knowledge
* 5 mins: presentation
* 15 mins: challenge
* 5 mins: feedback

Exercise 4:

* 5 mins: prior knowledge
* 5 mins: presentation
* 15 mins: challenge
* 5 mins: feedback

## Overview

In any non-trivial calculation, we want to let our computer remember
things, such as the content of a data file, or the parameters/settings
we use in our program. Variables allows one to make a computer
store ('remember') information. Here we use our first simple variables.

Also we practice converting an equation and a mathematical problem
to Python code. We will discover the helpful modulo operator.

## Exercises

### Exercise 1: working with variables

!!!- info "Learning objectives"

* Get the type of an object
* Create a variable
* Use a variable

Read the following sections of [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html):

- 2.1. Values and data types
- 2.2. Variables
- 2.3. Variable names and keywords

Then in section 2.14, do exercises 1 to and including 4.

### Exercise 2: an equation with exponentiation

!!!- info "Learning objectives"

* Practice converting an equation to Python code
* Find and use the operator for exponentiation

Read the following sections of [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html):

- 2.6. Operators and operands

Then in section 2.14, do exercise 5.

### Exercise 3: the modulo operator

!!!- info "Learning objectives"

* Practice the modulo operator
* Practice converting a simple text question to Python code

Read the following sections of [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html):

- 2.8. Order of operations
- 2.12. The modulus operator

Then in section 2.14, do exercises 5 and 6.

### Exercise 4: input

!!!- info "Learning objectives"

* Learn how to ask a user for input
* Use input in a calculation

Read the following section of [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html):

- 2.10. Input

Then in section 2.14, do exercise 7.

## Links

* [How to Think Like a Computer Scientist: Learning with Python 3](https://openbookproject.net/thinkcs/python/english3e/index.html)
6 changes: 3 additions & 3 deletions docs/morning_session/working_with_python_scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ In this session, we create and run some simple Python scripts.

### Exercise 1: create a Python script

- Learning goal:
- Learning objectives:
- to use a text editor in the terminal
- to create, edit and save a file in the terminal
- to create a trivial Python script to work on
Expand All @@ -55,15 +55,15 @@ Verify that the script has its contents saved.

### Exercise 2: run a Python script

- Learning goal: to be able to run a Python script.
- Learning objective: to be able to run a Python script.

Read the UPPMAX page on running a Python script, [here](http://docs.uppmax.uu.se/software/python/#running-python)

Run the Python script you just created.

### Exercise 3:

- Learning goal:
- Learning objectives:
- repeat creating a Python script
- to observe that an expression result is not shown on-screen by default

Expand Down
6 changes: 2 additions & 4 deletions lesson_plans/20240118/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ Non-goals:

## Schedule



| Time | Topic
|---------------|-------------------------------
| 09:00-10:00 | Loading Python on UPPMAX, 1.1, 1.9, ex 1.1-5
| 10:00-10:15 | Break
| 10:15-11:00 | Using a Python script, ex 1.6, Basic expressions, 2.1-2.9 ex 2.1-7
| 10:15-11:00 | Using a Python script, ex 1.6, Basic expressions, 2.1-2.3 ex 2.14.1-4
| 11:00-11:15 | Break
| 11:15-12:00 | Input, 2.10, ex 2.8
| 11:15-12:00 | Basic expressions, 2.4-2.9 ex 2.5-7 ; Input, 2.10, ex 2.8
| 12:00-13:00 | Lunch
| 13:00-14:00 | Modules, 3 all,
| 14:00-14:15 | Break |
Expand Down

0 comments on commit e9a890f

Please sign in to comment.