3.2 Programming Flashcards
Data types
Programming languages store data as different types and they are dealt with differently by the program.
INT
Integer - whole numbers, positive and negative
REAL
Numbers that have a decimal point- sometimes called FLOAT
BOOLEAN
Can have one of two values - true/false, yes/no, 1/0
CHAR
Character - a single letter, number or symbol
STRING
Used to represent text - it is a collection of characters
Casting
Changing one data type to another, e.g. converting string to integer
DIV operator
Returns the whole number part of a division, e.g. 5 DIV 2 = 2
MOD operator
Returns the remainder part of a division, e.g. 5 MOD 2 = 1
Assignment
Assigning a value to a variable or constant, e.g. total=25 assigns the value 25 to the variable total
Comparison operator
Compares the left hand side of an expression to the right hand side, e.g. 4<10 (is 4 less than 10)
Same as?
Python uses ==
Not the same as?
Python uses !=
Variable
A named data store which can change as the program is run
Constant
A named data store which cannot be changed as the program is run, e.g. pi
Local variable
A variable that is only defined and usable in certain parts of a program