
MicroBits revision lesson
Presentation
•
Computers
•
7th Grade
•
Practice Problem
•
Hard
G Alexander-Doyle
Used 3+ times
FREE Resource
10 Slides • 13 Questions
1
Code understanding
It is important to ensure you use the correct computational constructs when programming. Here are some examples of some common ones:
Assignment – Putting a value into a variable
Variables can be numbers or strings
- Number – Any whole number
- String – Any combination of text, numbers and special characters.
2
Assignment
In the Micro:Bit coding environment, assignment blocks are coloured in red. They begin with the words Change and Set to substitute a value for another and initialise variables respectively.
3
The random function
The random function assigns a random number to a variable within a given range. You can pick the range of numbers which the program can pick from. In this example any number between 1 and 3 will be assigned to the number variable.
4
Selection statements
selection (or sonditional) statement – A selection statement runs a piece of code only if a condition is met. It allows the program to make a decision. The block is a blue/green colour in the Micro:Bit coding environment and uses the words if, else if and else. It takes the following format…
5
Selection Statements
When comparing one piece of data with another we can use the following operators.
< Less than
> Greater than
≥ Greater than or equal to
≤ Less than or equal to
= Equal to
≠ Not equal to
6
Selection statements
We can also use else if to have the program test more than one condition in a single construct like below.
7
Fixed loop
Fixed loop - A fixed loop runs a piece of code a set number of times. Any code placed within the block will run for the number of times entered by the user. The fixed loop block can be found in the green loops category and begins with the phrase repeat _ times do.
Repeat for 1 to 4
…
End repeat
8
Conditional loops
Conditional loop - A conditional loop runs a piece of code until a condition is met. This is useful when the programmer does not know in advance how many times the loop will be required to run (for example when the user is entering a password, they may get it right on the first try or the second or the third).
while condition = true then do
end while
9
Conditional loops
The conditional loop block can be found in the green loops category and begins with the phrase while <false> do. The programmer would need to change the <false> block to the condition they wish to test.
In this example the number variable will be shown having been multiplied by two and then changed by one while the number is not equal to 20.
10
Conditional loops
while condition = true then do
…
end while
11
Multiple Select
Which words would you associate with the assignment coding construct? There are two correct answers below.
Repeat
If
Set
While
Change
12
Multiple Choice
Which word would you associate with the fixed loop coding construct?
Else
If
Repeat
While
Change
13
Multiple Select
Which words would you associate with the selection statement coding construct? There are two correct answers below.
Else
If
Repeat
While
Change
14
Multiple Choice
Which word would you associate with the conditional loop coding construct?
Else
If
Repeat
While
Change
15
Multiple Choice
What colour are the blocks in the category for loops?
Red
Green
Pink
Blue/green
16
Multiple Choice
What colour are the blocks in the category for selection statements?
Red
Green
Pink
Blue/green
17
Multiple Choice
What colour are the blocks in the category for assignment?
Red
Green
Pink
Blue/green
18
Multiple Choice
What colour are the blocks in the category input?
Red
Green
Pink
Blue/green
19
Open Ended
What does the random function do?
20
Multiple Choice
Which of the following operators indicate something is not equal to another?
=
>=
<=
≠
21
Multiple Choice
Which of the following operators indicate something is greater than or equal to another?
=
>=
<=
≠
22
Multiple Choice
Which of the following operators indicate something is equal to another?
=
>=
<=
≠
23
Multiple Choice
Which of the following operators indicate something is less than or equal to another?
=
>=
<=
≠
Code understanding
It is important to ensure you use the correct computational constructs when programming. Here are some examples of some common ones:
Assignment – Putting a value into a variable
Variables can be numbers or strings
- Number – Any whole number
- String – Any combination of text, numbers and special characters.
Show answer
Auto Play
Slide 1 / 23
SLIDE
Similar Resources on Wayground
17 questions
American Indians of Texas
Presentation
•
7th Grade
19 questions
Percents
Presentation
•
7th Grade
18 questions
Input and Output Systems
Presentation
•
7th Grade
21 questions
internet concepts 1st prep
Presentation
•
7th Grade
18 questions
Introduction to Argumentative Writing
Presentation
•
7th Grade
18 questions
7.10B Biodiversity
Presentation
•
7th Grade
18 questions
Surface Area
Presentation
•
7th Grade
18 questions
03.02.2021 - The Excretory System
Presentation
•
7th Grade
Popular Resources on Wayground
19 questions
Naming Polygons
Quiz
•
3rd Grade
10 questions
Prime Factorization
Quiz
•
6th Grade
20 questions
Math Review
Quiz
•
3rd Grade
15 questions
Fast food
Quiz
•
7th Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
20 questions
Inferences
Quiz
•
4th Grade
19 questions
Classifying Quadrilaterals
Quiz
•
3rd Grade