-
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
5bedfdb
commit e9a890f
Showing
4 changed files
with
119 additions
and
9 deletions.
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
111 changes: 111 additions & 0 deletions
111
docs/morning_session/variables_expressions_and_statements.md
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,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) |
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
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