Welcome 🤗! In the next ~4h we will cover:

Spiral Staircase in Vatican Museum Source © User:Colin / Wikimedia Commons CC BY-SA 3.0
Before we begin with the class:
we need two Feedback persons.
Activate notifications for Discussions, if you did not do it yet.
Answer the poll in 📊 Live poll:
How much time did you spent for homework and preparation?
0-2 h 🕐🕐
3-4 h 🕐🕐🕐🕐
5-6 h 🕐🕐🕐🕐🕐🕐
7+ h 🕐🕐🕐🕐🕐🕐🕐🕐
Test¶
(15 min)
Flowchart analysis¶
Compare flowchart with the text description and check correctness
E: Checking correctness¶
Peer feedback¶
Give feedback based on criteria.
Use a GitHub pull request to give feedback.
Giving feedback¶
Feedback can be formulated easier, if it is based on criteria. Criteria can in return improve how you do a task.
Here is an example, how we can give feedback for Exercise 3:
Input age, then name and store age and name in a database. If the user wants to enter more input, repeat the process.
Criteria | Comments |
|---|---|
Has a start and end | end is missing |
Used correct shapes | ok! |
Fits description | Age input must come first, more input condition missing |
Overall | You have the basics! Try to read the description again after you have drawn the flowchart. |
E: Peer feedback using GitHub¶
We will use Feedback in Pull requests for giving feedback to each other. The feedback pull request presents all the changes the user has done.
Tracking changes is a superpower of repositories.
Core programming concepts¶
Recognize sequence, selection, iteration in processes
Find examples of sequence, selection and iteration
Differentiate between control and data
Recognize condition in selections
E: Matching the three concepts¶
You watched the video about the Big 3 programming concepts. Compare your results with your neighbor as follows:
(3 min)
Why are the three concepts important?
Find one sequence (what comes after what?), one selection (what decides, what happens), and one iteration (what is begin iterated over, e.g., we iterate over sensor values collected at regular intervals) in the line counting process and lunar lander process.
Discuss with your partner.
The Big 3¶
We can describe any process using the following 3 structures.
Structure | Example | Code | |
|---|---|---|---|
altitude-check-sequence.py
| |||
altitude-check-selection.py
| |||
altitude-check-iteration.py
|
Control vs data¶
In programming, we distinguish between:
control: deciding what happens
data: the values being worked with
Example: In the altitude example, we have:
control:
sequence of output, input
iteration as long as altitude > 0
data:
altitude
the messages “Landing” and “Landed”
E: Control vs data¶
Similar to the previous example, find the control and data in the n times iteration example from Exercise 1.
(1 min)
Selection vs condition¶
Condition can be for example:
a == bIs a equal to b? Pay attention to double equal sign.
a != bIs a different from b?
a > b,a <= betcyou already know from math.
E: Selection vs condition¶
(1 min)
Similar to the previous example, find the control and data in the n times iteration example
Coding the process¶
Now use the previous Big 3 table to code the following examples.
If you are not familiar with programming, I recommend to draw a flowchart first and then code using the following recipe and the Big 3 table
What is the first block in the process you have to code? Is it an input, output? Replace them with
input()andprint().Do you want to introduce a new variable? Use
new = x + yDo you have a selection, or iteration? Use the templates from the Big 3 table, copy paste them, and modify them to fit your process.
While modifying, pay attention to the following concepts and their questions.
You can open the Big 3 table in a new window, so you can easily copy paste the code snippets into your editor.
E: Area of a square¶
(7 min)
Input the side_length of a square (🟦). Output thearea. Hint
Too small? How to open it in a new window:
Click Edit on Compiler Explorer on the bottom-right corner:

x * 10 multiplies x by 10.
The code will be run automatically after you modify it. The tab on the right shows the input provided to your program (10) so you don’t have to provide it manually. Your program should output 100 on the right tab.
If you get 100, change the input to 1 to test your program.
E: Energy level manager¶
(5 min)
Rate your energy_level from 1 to 10. If it is under 5, outputTake a nap.. Otherwise, output Go for a run!.
Test with at least two inputs: 5 and 4.
E: Counting laps¶
(5 min)
You’re a sports enthusiast building a simple coach app for runners. Ask the runner how many laps they want to run (lap_count). For simplicity, you’ll start by just tracking lap numbers that you have completed. For each lap output the current_lap_number starting from 1 until lap_count laps are completed. Finally outputWorkout done! 💪.[2]
Test with at least two inputs: 5 and 4. For example, the output for 5 should be:
1
2
3
4
5
Workout done! 💪Code runner¶
You find the editor on website’s menu on the left: ▶️ Code runner.
E: VSCodium installation support¶
Next time we will use VSCodium to code.
Did you run into any problems in Code editor? We will help each other, until everyone is on board.
Running a flowchart¶
Drawing flowcharts is already programming! See Running flowcharts, however flowcharts are often not enough to implement processes in detail compared to programming languages.
E: Reflection¶
(5 min)
Where do you have difficulties understanding? What could you do to resolve this?
Has thinking in terms of sequence/selection/iteration actually helped you approach today’s exercises ― or not yet? Give an example.

Can you spot this variable? 👀