This lesson contains 38 slides, with interactive quizzes, text slides and 2 videos.
Lesson duration is: 60 min
Items in this lesson
Year 9 programming basics
Slide 1 - Slide
66, 21, 38, 15, 89, 49 Write the order of the list after the first pass.
Slide 2 - Open question
What do we have to do the previous list in order to perform a binary search?
Slide 3 - Open question
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 - Slide
Data types
Slide 5 - Slide
What data types do you know?
Slide 6 - Open question
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 - Slide
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 - Slide
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 - Slide
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 - Slide
Initial
N
Surname
Chapman
Age
27
Height in metres
1.64
Married
No
Integer
Real/float
Boolean
Character
String
Slide 11 - Drag question
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 - Slide
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 - Slide
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 - Slide
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 - Slide
What line is a constant on?
A
1
B
5
C
6
D
10
Slide 17 - Quiz
What line is a variable on?
A
1
B
5
C
6
D
10
Slide 18 - Quiz
What value is stored in mod?
A
1
B
5
C
6
D
10
Slide 19 - Quiz
What is printed on line 9?
A
True
B
5
C
15
D
False
Slide 20 - Quiz
Python
C#
Java
Objective-C
Kotlin
Slide 21 - Drag question
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 - Slide
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 - Slide
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 - Slide
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 - Slide
Run Button
Text Editor
Debugger
Output Window
Slide 26 - Drag question
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 - Slide
What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision
Slide 29 - Quiz
What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision
Slide 30 - Quiz
What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision
Slide 31 - Quiz
An algorithm is a list of steps to follow in order to solve a problem.
Slide 32 - Slide
Let's create an algorithm to sign in to our student accounts.
Slide 33 - Slide
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 - Slide
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 - Slide
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 - Slide
How would you rate your current programming basics understanding?