1/70
topics covered: algorithms, python, micro:bit
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What are the inputs of a micro:bit?
Buttons, compass and accelerometer
What are the outputs of a micro:bit?
Speaker and LEDs
What is sequencing?
The concept that instructions are run in the order that they are written.
What is an interaction in python?
The concept in which you ask the user to enter an input to print statements.
What notation is used for an interacting input in phyton?
input()
If I want to ask for someoneās name using an input and store it in a variable called ānameā. What is the code I should use?
name = input()
What does int() do to an interacting input?
Converts the input from a text input to an integer input.
What does float() do to an interacting input?
Converts the input from a text input to a decimal input.
If I wanted to ask someone for their favourite integer and store it in a variable called āintegerā. How would I code it?
integer = int(input())
If I wanted to ask someone for their favourite decimal and store it in a variable called ādecimalā. How would I code it?
decimal = float(input())
What notation is used for assignment?
=
What is assignment?
The act of storing a value in a variable.
What notation is used to compare a value to a variable?
==
What is a variable?
Containers that hold data in code; the data can change later during execution.
How is data assigned to a variable?
=
What is concatenation?
The act of linking strings and variables using +
How would you print the word: Hello?
print(āHelloā)
How would you print the variable Hello?
print(Hello)
How would you print the string Hello and the variable name1?
print(āHelloā + name1)
What is selection?
An algorithmic construct in which a condition is used to decide which instructions (if any) will be executed creating choices/branches in code.
The algorithm selects which path to follow based on the outcome of a true/false condition. (if/elif/else)
What 3 coding terms are used in selection?
if, elif, else
What comes first in the 3 selection coding terms?
if
What comes last in the 3 selection coding terms?
else
What comes in the middle of the 3 selection coding terms?
elif
What do you have to do to all code inside a selection term? (if/elif/else)
Indent it.
What case do the selection terms have to be in a program? (if/elif/else)
Lowercase.
What punctuation comes after a selection term?
A colon.
What has to be after an if or elif statement. (Not punctuation)
A comparison.
What syntax are used for comparisons?
==, <, >, <=, >= and !=
Comparison syntax: What does == mean?
Equal to
Comparison syntax: What does > mean?
Greater than
Comparison syntax: What does < mean?
Less than
Comparison syntax: What does <= mean?
Less than or equal to.
Comparison syntax: What does >= mean?
Greater than or equal to.
Comparison syntax: What does != mean?
Not equal to.
What is an algorithm?
An unambiguous (clear) sequence of instructions which must terminate and solve a problem or perform a task.
What are the features of an algorithm?
It is unambiguous
It must stop
It must solve a problem or perform a task
It must be performed in a certain order
What are the four standard flowchart shapes?
Oval, parallelogram, rectangle and diamond
How can an algorithm be presented?
Plain English
Flowchart
Pseudocode (blocks)
Code
What is the use of an oval in a flowchart?
It denotes the start/end of an algorithm
What is the use of an arrow in a flowchart?
It denotes the direction of the algorithm in which the sequence flows.
What is the use of a parallelogram in a flowchart?
It denotes an input/output.
What is the use of a rectangle in a flowchart?
It denotes a process.
What is the use of a diamond in a flowchart?
It denotes a decision.
What comes out of a diamond in a flowchart?
2 arrows labelled yes/no to denote a decision.
What is a dry run?
The process of executing an algorithm on pencil and paper to ensure it is functioning.
What is a trace table?
A method to record and work out variable values and outputs according to code with each column representing a variable/output and new row representing a change of value in a variable.
What is iteration?
The repetition of a section of an algorithm using a decision
What is the keyword used to start a loop in python?
while
Why is repetition important in algorithms?
To simplify the repeating of steps if needed in an algorithm.
Which flowchart shape starts a loop?
Decision; kite
What are your columns in a trace table?
Your variables and the output.
What are the two types of loops?
Count controlled loop
Condition controlled loop
How do you show which lines of code are in a loop?
Indentation.
What comes at the end of āwhileā?
:
What is the difference between a count controlled loop and a condition controlled loop?
A count controlled loop is stopped after certain code is repeated a certain amount of times.
Whereas, a condition controlled loop is stopped after certain code is repeated until a certain condition is met.
What is a āloopā?
A sequence of code that is repeated over and over again until a count/condition is met.
What is a count controlled repetition construct?
The concept/construct that an action is repeated a given number of times.
What is a condition controlled repetition construct?
The concept/construct that an action is repeated until a condition is met.
What is a while construct?
The concept/construct that allows a group of instructions to be repeated over and over, using āwhileā.
On a flowchart, how is the indented section of a loop shown?
The end of the indented section will have an arrow linking back to what started the loop, the code in between will be the indented section of a loop. This also shows a loop effectively.
How can you make a condition controlled loop a count controlled loop (by technicality).
By intentionally making the condition met in a condition controlled loop a variable which goes up by a certain value each time and reach the condition (a certain number). Which is what is used for a ācount controlled loopā in python.
What is an input?
data sent to a computer
What is an output?
data processed by a computer with an outcome
Define the term āfiniteā.
something which has a clear start and end
Define the term āunambiguousā
something that is clear and precise
What is a flowchart?
graphical method of presenting an algorithm using symbols and arrows.
What is psuedocode?
method of describing an algorithm with structure similar to an actual code.
What is syntax?
notations/symbols which put together key parts of code, making algorithms able to do the right things.
What is a syntax error?
an error caused by a misuse of syntax
What is repetition?
Algorithmic construct in which a group of statements is executed repeatedly for a certain amount of times/until a condition is met