Year 10 programming basics

Year 10 programming basics
1 / 44
next
Slide 1: Slide
ComputingUpper Secondary (Key Stage 4)GCSE

This lesson contains 44 slides, with interactive quizzes, text slides and 1 video.

time-iconLesson duration is: 60 min

Items in this lesson

Year 10 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
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 - 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.
- ord("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

Identify how casting has been used in this code?

Slide 14 - Open question

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 - Quiz

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 - 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 17 - Slide

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 - Slide

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 - Slide

Slide 20 - Link

Slide 21 - Link

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 - Slide

What line is a constant on?
A
1
B
5
C
6
D
10

Slide 24 - Quiz

What line is a variable on?
A
1
B
5
C
6
D
10

Slide 25 - Quiz

What value is stored in mod?
A
1
B
5
C
6
D
10

Slide 26 - Quiz

What is printed on line 9?
A
True
B
5
C
15
D
False

Slide 27 - Quiz

Python
C#
Java
Objective-C
Kotlin

Slide 28 - 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 29 - 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 30 - 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 31 - 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 32 - Slide

Run Button
Text Editor
Debugger
Output Window

Slide 33 - Drag question

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 - Slide

What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision

Slide 35 - Quiz

What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision

Slide 36 - Quiz

What is this symbol called?
A
Terminator (start/end)
B
Process
C
Input/output
D
Decision

Slide 37 - Quiz

An algorithm is a list of steps to follow in order to solve a problem.

Slide 38 - Slide

Let's create an algorithm to sign in to our student accounts.

Slide 39 - 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 40 - 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 41 - 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 42 - Slide

How would you rate your current programming basics understanding?
πŸ˜’πŸ™πŸ˜πŸ™‚πŸ˜ƒ

Slide 43 - Poll

One thing I learned this lesson was.

Slide 44 - Open question