2- Programming Flashcards
To yeet and skeet
Variable
A named space in memory, large enough to store a single piece of data. Each variable has a data type.
Constant
A named space in memory with a value that can never change while the program is running. Useful for pi(which will never change) or VAT (which seldom changes). The Python language does not allow for constants, but some other languages do
Boolean
Can be either true or false
Character
A single letter, number, punctuation mark, space, etc.
Integer
Whole numbers - positive, negative or zero
Real
Decimal numbers - positive or negative (zero can also be stored in a ‘real’ variable
String
A collection of characters, used to store names, addresses, phone numbers, etc.
Declaration
Code that causes a variable to exist. Once a variable has been declared, it can be used. Trying to use a variable before it has been declared will cause an error
Assignment
The process of putting a value into a variable. Most languages use a single equals ‘=’ to do this. In the instruction i = 5, the value ‘5’ has been assigned to the variable ‘i’
Sequence
Means that instructions will always execute in the order in which they were written. Every line will be executed once and only once
Iteration
Means ‘looping’. Code that is iterative might be executed multiple times, even though it is only written once
Nesting
This involves placing one programming structure inside another one. The code above contains an IF structure (on the penultimate line) that is nested within the WHILE structure. There is no limit to the number of levels of nesting; that IF structure could have contained another WHILE structure, which itself contained another WHILE structure
Operation
An operation is an action that is performed on one or more pieces of data in order to produce additional data. There are arithmetic operations, relational operations and Boolean operations
Arithmetic operations
A process performed on one or more numbers. Examples include: + - * /
Relational operation
A comparison between two values to check, for example, whether they are equal or whether one is less than or greater than the other. Relational operations are found in IF statements and as part of loops (><=)
Logic operation
A logic operation can have one of only two outcomes - true or false. A logic operator connects together logic expressions to produce more complex logic expressions. AND, NOT and OR are the most commonly used logic operators
Data Structure
A structured (organised) means of storing related data. While a variable can only store a single piece of data, a data structure can contain many
One dimensional array
A data structure for storing multiple data items of the same data type. Think of a one-dimensional array as a row of variables. Instead of each one having a name, the whole array has a single name, while each element in the array has an index number.
The first element is always numbered ‘0’
Two-dimensional array
A data structure for storing multiple data items of the same data type. Like a one-D array but can be considered as a grid rather than a row
Elements are referred to with two numbers, much like ‘x’ and ‘y’ coordinates
Record
A data structure that can accept multiple data items. that do not need to be of the same data type. As far as Python is concerned, there is no difference between array and records, so they are managed in the same way. One record might store a student’s name, year group and average test score
Input
The process of introducing data into a computer system. An example of an input device is a keyboard
Output
The process of communicating data beyond the system, typically to a human user. An example of an output device is a monitor
File
A store of data, used by a program, that continues to exist when the program, and even the computer itself, is no longer running. Many file formats exist, and the practical aspects of this chapter deal with text (.txt) files, typically associated with a program called ‘Notepad’
Casting
Converting a piece of data to a specific data type. E.g: a user might enter a string, and the program might convert it to an integer in order to allow certain calculations
Random
A random number has been selected from a range of numbers if every number in that range had an equal chance of being selected