In deze les zitten 38 slides, met interactieve quizzen, tekstslides en 2 videos.
Lesduur is: 60 min
Onderdelen in deze les
Year 9 programming basics
Slide 1 - Tekstslide
66, 21, 38, 15, 89, 49 Write the order of the list after the first pass.
Slide 2 - Open vraag
What do we have to do the previous list in order to perform a binary search?
Slide 3 - Open vraag
Learning Intension
To be able to identify and use basic data types and operators. Use operators and comparions to perform basic arithmetic and assign values to constants and variables.
Slide 4 - Tekstslide
Data types
Slide 5 - Tekstslide
What data types do you know?
Slide 6 - Open vraag
Programming languages store data and their type, this is important when data is being used.
Integer
int
whole numbers only
0, 6, 10293
Real/float
real/float
numbers with a decimal point
0.15, -5.87
Boolean
bool
true or false
True, yes
Character
char
single letter, number, symbol
'A', '5', '!'
String
str
collection of characters
'FSTM', '1! 9'
Slide 7 - Tekstslide
These data types allocate different amouts of memory, meaning calling using string for a character is memory ineffecient. This highlights why correct typing is important.
Integer
4 bytes
Real/float
4 bytes
Boolean
1 bit
Character
1 byte
String
1 byte for every character
Slide 8 - Tekstslide
4 or 8 bytes is the length of a 'word'. 'word' is the unit data for how many bits the cpu can read/write at one time, this is dependent on cpu architecture 32b vs 64b. In olden times games consoles were referenced by their bit size.
Nes
8 bit
Snes
16 bit
Ps
32 bit
N64
64 bit
Slide 9 - Tekstslide
Casting is used to change data types, this can be done using functions with the data type required.
- int()
- real()
- bool()
- str()
You can also find ASCII numbers or characters using functions.
- ASC(b) converts to 98
- CHR(98) converts to 'b'
Slide 10 - Tekstslide
Initial
N
Surname
Chapman
Age
27
Height in metres
1.64
Married
No
Integer
Real/float
Boolean
Character
String
Slide 11 - Sleepvraag
What is a constant or variable?
- Data can be stored as ether.
- Constant is a value assigned (=) when initialised and cannot be changed.
- Variables can have their value changed but not their type.
- Casting creates a new variable with the new type.
- In other languages eg C types need to be assigned when a variable is made example int age = 27.
Slide 12 - Tekstslide
Slide 13 - Video
Operators are special characters, they perform certain functions. These are the same as operators in maths.
- Addition, subtraction, division and multiplication.
- Exponentiation, used to raise a number to a power.
- Quotient returns the whole number part.
- Modulus return the remainder part.
Slide 14 - Tekstslide
Addition
+
5 + 5
10
Subtraction
-
5 - 5
0
Division
/
5 / 5
1
Multiplication
*
5 * 5
25
Exponential
^ or
2 ^ 5
32
Quotient
DIV
20 DIV 3
6
Modulus
MOD or %
20 MOD 3
2
Slide 15 - Tekstslide
Assignment vs comparison operators. The assignment operator = assigns values to constants or variables. The comparison operator == is for comparision operators. Comparisons produce a true or false answer.
==
Equal to
5 == 5
5 == 7
!=
Not equal to
6 != 7
6 != 6
<
Less than
4 < 10
10< 4
>
Greater than
10 > 4
4 > 10
<=
Less or equal to
7 <= 8
11 <= 10
>=
Greater or equal to
3 >= 3
9 >= 12
True
False
Slide 16 - Tekstslide
What line is a constant on?
A
1
B
5
C
6
D
10
Slide 17 - Quizvraag
What line is a variable on?
A
1
B
5
C
6
D
10
Slide 18 - Quizvraag
What value is stored in mod?
A
1
B
5
C
6
D
10
Slide 19 - Quizvraag
What is printed on line 9?
A
True
B
5
C
15
D
False
Slide 20 - Quizvraag
Python
C#
Java
Objective-C
Kotlin
Slide 21 - Sleepvraag
Think of an IDE like a toolbox for a programmer. Just as a builder needs tools like a hammer, saw, and level to construct a house, a programmer uses tools within an IDE to build, run, and test their code.
Slide 22 - Tekstslide
Definition: βAn Integrated Development Environment (IDE) is software that helps you write, run, and debug programs more easily. It combines all the tools a programmer needs in one place.β
Slide 23 - Tekstslide
Features on an IDE:
- Text Editor: Where you write your code, like using a notebook.
- Run/Execute Button: Allows you to see what your code does instantly.
- Debugger: Helps find and fix mistakes in your code.
- Output Window: Displays the results of your code, like a calculator screen.
Slide 24 - Tekstslide
Benefits of an IDE:
Ease of Use: An IDE can check your code for errors as you type, saving time.
Efficiency: You donβt have to switch between multiple tools or programs.
Learning Support: Many IDEs provide helpful hints and autocomplete features for beginners.
Slide 25 - Tekstslide
Run Button
Text Editor
Debugger
Output Window
Slide 26 - Sleepvraag
Slide 27 - Video
A procedure is a reusable block of code that performs a specific task. This is for code effeciency and saves the need for writting code.
def procedureName():
bbbbb
b bb
bbbbb
b. bb
bbbbb
Slide 28 - Tekstslide
What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision
Slide 29 - Quizvraag
What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision
Slide 30 - Quizvraag
What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision
Slide 31 - Quizvraag
An algorithm is a list of steps to follow in order to solve a problem.
Slide 32 - Tekstslide
Let's create an algorithm to sign in to our student accounts.
Slide 33 - Tekstslide
1. Take a user input for username
2. Take a user input for password
3. Check if username = username and password = password then log in
4. Else ask them to try again tries +1
5. If tries > 3 then lock account
Slide 34 - Tekstslide
Interpretered language is read line by line and translated using a dictionary.
Python is an example of a interpreted language, programms run slower as real time translation is required.
Slide 35 - Tekstslide
A compiled language is translated before execution by a compiler, which converts the entire source code into a standalone executable file (e.g., .exe). This allows the program to run faster because it doesn't require real-time translation. C is an example of a compiled language.
Slide 36 - Tekstslide
How would you rate your current programming basics understanding?