In deze les zitten 44 slides, met interactieve quizzen, tekstslides en 1 video.
Lesduur is: 60 min
Onderdelen in deze les
Year 10 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
By the end of this lesson you will 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.
- ord("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
Identify how casting has been used in this code?
Slide 14 - Open vraag
A teacher researches the length of time students spend playing computer games each day. Identify the data type you would choose to store the data.
A
string
B
int
C
real
D
bool
Slide 15 - Quizvraag
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 16 - 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 17 - Tekstslide
all - Solve these.
most: create a variable called total and sum up the 5 equations.
some: allow the user to input the 2 numbers.
Slide 18 - Tekstslide
let's create a calculator.
step 1 - take an input from the user on which equation they want? hint, how many are there?
step 2 - how do we select something based on the number entered? hint, selection statement?
step 3 - create the separate calculator functions. hint, have we done this already?
step 4 - take 2 numbers as inputs from the user. hint, what DATA TYPE does this need to be?
step 5 - display the result. hint, what are we printing out?
stretch - allow the user to keep using the calculator. hint, loops?
Slide 19 - Tekstslide
trinket.io
Slide 20 - Link
trinket.io
Slide 21 - Link
trinket.io
Slide 22 - Link
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 23 - Tekstslide
What line is a constant on?
A
1
B
5
C
6
D
10
Slide 24 - Quizvraag
What line is a variable on?
A
1
B
5
C
6
D
10
Slide 25 - Quizvraag
What value is stored in mod?
A
1
B
5
C
6
D
10
Slide 26 - Quizvraag
What is printed on line 9?
A
True
B
5
C
15
D
False
Slide 27 - Quizvraag
Python
C#
Java
Objective-C
Kotlin
Slide 28 - 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 29 - 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 30 - 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 31 - 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 32 - Tekstslide
Run Button
Text Editor
Debugger
Output Window
Slide 33 - Sleepvraag
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 34 - Tekstslide
What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision
Slide 35 - Quizvraag
What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision
Slide 36 - Quizvraag
What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision
Slide 37 - Quizvraag
An algorithm is a list of steps to follow in order to solve a problem.
Slide 38 - Tekstslide
Let's create an algorithm to sign in to our student accounts.
Slide 39 - 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 40 - 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 41 - 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 42 - Tekstslide
How would you rate your current programming basics understanding?