Notas
2.2 Programming - created from Mind Map
Conteúdo das notas (1)
Página 1
Variables
Key words
Operators
Sequencing
SELECTION
ITERATION
Should not start with a number or contain spaces
Is a specific data type
Whole number
Real number
Boolean
String
no decimals/fractions
has a fractional part
Trueorfalse
any text that isn't meant to be calculated
Operators represent the operations that are performed on the data.
operators in Maths, e.g. +, -, /, *, ^, etc.
Boolean: AND, OR, NOT, larger, smaller, equal, not equal
Strings/characters: slicing, length, format
Addition total = amount + VAT Subtraction e.g. age = cur_year – y_birth Division divide = 5 / 2 Modular division myRemainder = 5 MOD 2 (find a remainder) Integer division intDivision = 5 DVI 2 Multiplication totalCost = cost * 0.2 Exponential area = 3.1 * radius^2
Numbers: addition, subtraction, division, modular division (division with a remainder), integer division, multiplication, to-the-power-of, negation
Sequencing allows a programmer to solve complex tasks through a number of simple steps.
BENEFITS
NEGATIVES
Each line follows the next Create simple programs very quickly Easy to follow for a small program Fundamental principal of a program - Starts at the top, finishes at the bottom
Not at all efficient Becomes very difficult to follow with large programs Extremely hard to maintain
Selection changes the flow of a program, depending on a set of conditions, it is used for validation, calculation and making sense of a user’s choices.
The use of selection allows a computer to “think” – make decisions
Apart from efficiency in reducing the number of lines of code we would run, we need programs to make decisions based on a set of criteria or condition. If the condition is true, we run this set of lines of code, if the condition is false – we run some other set of lines.
The two common types of iteration: WHILE (condition-controlled) and FOR COUNTER (counter-controlled)
loops are called “iteration” because they run through or “iterate” through multiple similar items of data.
FOR COUNTER
WHILE
This is the loop for when we know in advance how many times we want to loop back to the start, so we keep count and check against the number of repetitions (iterations) that are required, using a counter.
we use counters as virtual beads to know when to stop.
Sometimes, we don’t know in advance how many times we want to repeat something, so we use “conditional” or “condition-controlled” loops. These loops evaluate a Boolean condition every time they run (either in the beginning or the end of an iteration) and if it is true – they carry on, otherwise, the loop stops.
These loops are better for user interfaces, or in general to allow interaction of the program with the outside world.
Informações
- Descrição
- Year 10 Computing Notas sobre 2.2 Programming - created from Mind Map, criado por Khang Duong em 18-01-2019.
- Criado por
- Khang Duong
- Visualizações
- 8
- Histórico
-
- Criado por Khang Duong · 18 jan 2019
- Copiado para Nota por Khang Duong · 18 jan 2019
- Avaliação