Variables and Constants:
● Each variable and constant is one of these spaces in memory that is given an
identifier (A name given to a variable, constant, data structure or subroutine).
● Variable - A named memory location that stores data. The data can change whilst a
program is running.
● Constant - A named memory location that stores data. The data cannot change
whilst a program is running.
● Putting data into a variable is done using an assignment statement. The left-hand
side of the equals sign is the identifier. The right-hand side of the equals sign is the
value.
● To get data out of a variable, you just use its identifier.
1
,Converting between data types:
Number<-- int("123")
number = int("123")
Value<-- string(22.4)
value = str(22.4)
Input and Output:
● Input - A user entering data into the program, usually with a keyboard
● Output - Data that is displayed to the user, usually on-screen
● A program at some point, will have to give some information to the user. It does this
using OUTPUT.
● A program might need the user to input some data. To do this, the command word
‘INPUT’ is used. This cannot appear on its own, otherwise, the data entered will
disappear into space. So you need to do something with it, such as store it in a
variable.
Arithmetic operators: Instructs a program to perform calculations. Parentheses are used to
change the order of the calculations.
2
,Sequence:
● One of the three constructs within programs. A sequence is a series of statements
that are executed(run) once, in the order they are written.
Selection:
● Selection is the second of the three constructs. In selection, a condition is checked,
determining which, if any, code is run. There are two forms of selection - IF
statements and CASE statements.
● ELSEIF is used in Pseudocode and elif is used in Python.
● There is no CASE statement in Python.
3
, Conditions need logical operators, these allow for comparisons to be made:
Boolean operators:
Iteration:
4