Please enable JavaScript.
Coggle requires JavaScript to display documents.
2.2.1 - programming fundamentals - Coggle Diagram
2.2.1 - programming fundamentals
DEFINITIONS
variable = an identifier for a memory location used to store data that
CAN
be changed whilst the program is running
constant = variable = an identifier for a memory location used to store data that
CANNOT
be changed whilst the program is running
assignment = giving a variable a value - an '='
comparison - a double equals - '=='
casting = converting one data type into a different data type - do it by writing the data type in front of it (e.g. float() )
ARITHMETIC FUNCTION
DIV
DIV (integer division/floor division)
divides and gives
INTEGER
part of value only
in python, represented as "//"
MOD (modulo/modulus)
divides and gives
REMAINDER
part of answer
in python, represented as "%"
division - in python, '/'
addition - in python '+'
subtraction - in python, '-'
multiplication - in python, '*'
indices - in python, '**'
DIV - in python, '//'
MOD - in python, '%'
DATA TYPES
integer = whole number
real/float = decimal number
boolean = 2 possible values (true or false)
character = one single letter/number/combination
string = multiple characters
BOOLEAN OPERATORS
NOT gate
reverses value of a single input (e.g. 0 becomes 1)
AND gate
2 inputs, one output- both inputs must be on for output to be on
OR gate
2 inputs, one output - either input can be on for output to be on
truth tables
shows the possible value of outputs for all the possible values of inputs
number of lines = 2^n
n = number of
inputs
: