P1 WEEK 3 M3 - INFORMATIE TECHNOLOGIE

Week 3 lesson 1
1 / 53
suivant
Slide 1: Diapositive
InformaticaMiddelbare schoolhavoLeerjaar 4

Cette leçon contient 53 diapositives, avec quiz interactifs et diapositives de texte.

time-iconLa durée de la leçon est: 90 min

Éléments de cette leçon

Week 3 lesson 1

Slide 1 - Diapositive

Startklaar zitten.
STARTKLAAR!
Tellie in zakkie

Slide 2 - Diapositive

Startklaar zitten.
Activate prior knowledge

Slide 3 - Diapositive

Cet élément n'a pas d'instructions

What is a programming language?
A
A language for instructing computers.
B
A language to sing.
C
A language for cooking.
D
A language to talk to friends.

Slide 4 - Quiz

Cet élément n'a pas d'instructions

Lets Play ! 

Slide 5 - Diapositive

Cet élément n'a pas d'instructions

What is a Variable?
A variable is like a container that stores information in a program.
You can name it and put different types of data inside (like numbers or text).

Slide 6 - Diapositive

Cet élément n'a pas d'instructions

Types of Variables
Numbers: Used to store numerical values (e.g., age = 15).
Text: Used to store words or sentences (e.g., name = "Alice").
Booleans: Used to store true/false values (e.g., isStudent = true).

Slide 7 - Diapositive

Cet élément n'a pas d'instructions

Why Use Variables?
Variables make programs flexible by allowing data to change.
Instead of hard-coding information, you can reuse and update variables easily.

Slide 8 - Diapositive

Cet élément n'a pas d'instructions

How to Use a Variable

Create a variable: Give it a name and assign a value (e.g., score = 0).
Change its value as needed during the program (e.g., score = 10).

Imagine you have a game and want to keep track of the player’s points:
score = 0 # The game starts, and the player has 0 points
score is the variable. It holds the number of points.

When the player gets more points, we change the variable:
score = score + 10 # The player gets 10 points
Now the score variable is 10.







Slide 9 - Diapositive

Cet élément n'a pas d'instructions

LEARNING OBJECTIVES
The student can understand and apply variables in programming using the control structure.

Lets Play ! 


Slide 10 - Diapositive

Cet élément n'a pas d'instructions

For the teacher
The student can:
Explain what a variable is and what it is used for in a program.
Recognize and use different types of variables (such as numbers, text, and Booleans) correctly.
Create a variable, assign it a value, and change the value of the variable during program execution.
Understand how variables can help make programs flexible and efficient by storing data that can be used or changed later.

Slide 11 - Diapositive

Cet élément n'a pas d'instructions

Data types
In programming we talk about data types for example:
String = "1234567890-=][poiuytreADFGG" for example "Yourname"
Int = 0123456789 for example 85
Boolean = true or false for example True
A boolean should not go together with a string
In the real world we actually also have a kind of data types for example the picture below. It is impossible to be a dog and a bear together because they are built differently


Slide 12 - Diapositive

Cet élément n'a pas d'instructions

A variable
A piece of space in the computer's memory that you or the computer can change
below is a variable created with the datatype string
var name = "Elif"
In the memory is the variable name created. In that memory we have stored "Elif"



Slide 13 - Diapositive

Cet élément n'a pas d'instructions

A variable
var name
var isTeacher
var age
Change variable

name = "elif"
isTeacher = true
age = 39
Now what are the new values ​​of the variables? Write them down on a piece of paper

Slide 14 - Diapositive

Cet élément n'a pas d'instructions

what was your answer

Slide 15 - Carte mentale

Cet élément n'a pas d'instructions

A variable
naam
isDocent
leeftijd
Change variable
name = name + "el'if"
age = age + 39
Now what are the new values ​​of the variables?
Write them down on a piece of paper

Slide 16 - Diapositive

Cet élément n'a pas d'instructions

what was your answer

Slide 17 - Carte mentale

Cet élément n'a pas d'instructions

Creating assignments



Quizlet

https://quizlet.com/324147133/variables-computer-science-flash-cards/

Slide 18 - Diapositive

Cet élément n'a pas d'instructions

I now know what a data type is and how to create a variable
Ja
Deels
Nee

Slide 19 - Sondage

Cet élément n'a pas d'instructions

I now know how to use a control structure
Ja
Deels
Nee

Slide 20 - Sondage

Cet élément n'a pas d'instructions

Can you write some examples of data types and tell what data type it is?

Slide 21 - Question ouverte

Cet élément n'a pas d'instructions

Can you make a variable to store an age. Also use a control structure. if your age is older than 18 then you are allowed to go to the horror movie otherwise not. use console.log to state "yes to horror movie" or "not to horror movie"

Slide 22 - Question ouverte

Cet élément n'a pas d'instructions

Summary
- Review in class

Slide 23 - Diapositive

Cet élément n'a pas d'instructions

Week 3 les 2

Slide 24 - Diapositive

Startklaar zitten.
STARTKLAAR!
Tellie in zakkie

Slide 25 - Diapositive

Startklaar zitten.
Voorkennis activeren

Slide 26 - Diapositive

Cet élément n'a pas d'instructions

create a variable to store the car color. if the color is white then console.log("2x per week wash ") else console.log("1 x per week wash")

Slide 27 - Question ouverte

Cet élément n'a pas d'instructions

Learning objectives
The student can use a for loop in a program to perform repetitive tasks.


Slide 28 - Diapositive

Cet élément n'a pas d'instructions

For the teacher
The student can:

Explain what a for-loop is and what it is used for in a program.
Write a for-loop to repeat a task multiple times, such as printing a series of numbers or repeating a text.
Understand how the structure of a for-loop works, including the initial value, the condition and the step size (increment).
Apply a for-loop in your own code to solve repetitive tasks, such as iterating through a list or performing a calculation multiple times.

Slide 29 - Diapositive

Cet élément n'a pas d'instructions

Instructions to the computer
ga naar https://www.programiz.com/javascript/online-compiler/

type the following over




Slide 30 - Diapositive

Cet élément n'a pas d'instructions

Instructions to the computer
Steps to Use on Programiz:

Open the Programiz JavaScript Online Compiler.
Writethe code above into the editor.
Click the "Run" button.
The numbers 1 to 10 will be printed in the output section.

Slide 31 - Diapositive

Cet élément n'a pas d'instructions

LOOP
// This program will print the numbers from 1 to 10
console.log("Numbers from 1 to 10:");
for (let i = 1; i <= 10; i++) {
    console.log(i); // Print the value of i in each loop
}
// Explanation:
// 1. 'let i = 1;' starts the loop at 1
// 2. 'i <= 10;' means the loop will run until i is 10
// 3. 'i++' increases the value of i by 1 each time the loop runs



Slide 32 - Diapositive

Cet élément n'a pas d'instructions

Explaining the code 

for loop: This loop runs a block of code a specific number of times.

let i = 1: This initializes the loop and sets i to 1.
i <= 10: This is the condition that keeps the loop running as long as i is less than or equal to 10.
i++: After each loop, the value of i increases by 1.
In each iteration, console.log(i) prints the current value of i.


Slide 33 - Diapositive

Cet élément n'a pas d'instructions

Print Even Numbers:

Modify the loop to print only even numbers between 1 and 10.


for (let i = 2; i <= 10; i += 2) {
    console.log(i);
}

Slide 34 - Diapositive

Cet élément n'a pas d'instructions

Countdown from 10 to 1: Modify the loop to count down from 10 to 1.
for (let i = 10; i >= 1; i--) {
    console.log(i);
}

Slide 35 - Diapositive

Cet élément n'a pas d'instructions

We can do this more easily
Answer the following questions and write them down on a piece of paper

What do you notice about the structure of the commands you entered?
Can you recognize a pattern in the code?
Do you think you can automate this process? How would you do that?

Slide 36 - Diapositive

Cet élément n'a pas d'instructions

Write your answer below

Slide 37 - Question ouverte

Cet élément n'a pas d'instructions

Complete the assignment
Look at the assignment in teams

period 1 week 3 assignment 4/6



Slide 38 - Diapositive

Cet élément n'a pas d'instructions

Now with a for loop
ga weer naar https://www.programiz.com/javascript/online-compiler/

Delete your old code and rewrite the code below.

Slide 39 - Diapositive

Cet élément n'a pas d'instructions

Write a forloop where your name is printed 10 times on the screen?

Slide 40 - Question ouverte

Cet élément n'a pas d'instructions

Summary
Review in class

Slide 41 - Diapositive

Cet élément n'a pas d'instructions

Week 5 
IF & ELSE

Slide 42 - Diapositive

Cet élément n'a pas d'instructions

Introduction to JavaScript If-Else Statements
  • JavaScript uses if-else statements to make decisions.
  • These statements allow your code to take different actions based on conditions.
  • We will learn how to check conditions and perform different tasks depending on whether the condition is true or false.
  • Work on https://www.programiz.com/javascript/online-compiler/

Slide 43 - Diapositive

Cet élément n'a pas d'instructions

What is a Condition?
  • A condition is a statement that can either be true or false.
  • Example: “If it rains, I will take an umbrella.”
  • In programming, conditions are used to make decisions.

Slide 44 - Diapositive

Cet élément n'a pas d'instructions

Basic If Statement

Slide 45 - Diapositive

Cet élément n'a pas d'instructions

Slide 46 - Diapositive

Cet élément n'a pas d'instructions

Adding an Else Statement

Slide 47 - Diapositive

Cet élément n'a pas d'instructions

Slide 48 - Diapositive

Cet élément n'a pas d'instructions

Multiple Conditions with Else-If

Slide 49 - Diapositive

Cet élément n'a pas d'instructions

Slide 50 - Diapositive

Cet élément n'a pas d'instructions

Comparison Operators
== : Equal to
!= : Not equal to
> : Greater than
< : Less than
>= : Greater than or equal to
<= : Less than or equal to

Slide 51 - Diapositive

Cet élément n'a pas d'instructions

Comparison Operators
if (x == 10) { ... }
if (y != 5) { ... }

Slide 52 - Diapositive

Cet élément n'a pas d'instructions

Recap of If-Else Statements

Use if to check if a condition is true.
Use else to define what happens if the condition is false.
Use else if for multiple conditions.

Slide 53 - Diapositive

Cet élément n'a pas d'instructions