1.8 Flashcards
What is a variable?
A variable is a named memory location that holds data that during the execution of a program, the data can change.
Define constant.
A constant is fixed data that during the execution of a program cannot change.
What is an operator?
An operator is a symbol used to instruct a computer to perform a specific operation on one or more values. E.g. arithmetic, comparison
What is a programming construct?
A programming construct determines the order in which lines of code are executed and controls the logic and behaviour of code.
The three core programming constructs are?
The three core programming constructs are sequence, selection, and iteration.
Define sequence
Sequence refers to lines of code which are run one line at a time in the order they are written from first to last.
What is selection?
Selection is when the flow of a program is changed depending on a set of conditions, determining which lines or block of code runs next.
What is casting?
Casting is when you convert one data type to another data type.
what does the % operator do
Gives the remainder of a division
10%3=1
what does the // operator do
gives the numbger of times the divider fits into the divided number
10//3=3
code to make things uppper and lowercase
var.upper() and var.lower()
code for lenghth of a string
len(var)
code for concatination
var1+var2