2.2 Programming Fundamentals Flashcards
What are programs?
Sequences of instructions for a computer.
What is a variable ?
A named memory address that holds a value.
What is a global variable ?
Variable that can be accessed and changed throughout the program
What is a local variable ?
variables are confined to a loop or subprogram
What are the three basic programming constructs ?
- Sequence
- Selection
- Iteration
What is a sequence ?
A set of instructions that follow on one from another
What is a selection ?
A decision where the program decides to move on based on the results of an event.
What is an iteration ?
The repetition of a block of statements within a computer program.
What are the two types of iteration ?
- Count-controlled
- Condition-controlled
How does a selection work ?
By testing a condition
What is a count-controlled iteration ?
- repeatedly executes a section of code a fixed number of predetermined times
- for loop
What is a condition-controlled iteration ?
- repeatedly executes a section of code until a condition is met - or no longer met
- while loop
What is nesting ?
Including one programming construct within another.
What are the two types of nesting ?
- Nested selection
- Nested Iteration
What is an operator ?
a character that determine what action is to be performed.
What is a data type ?
data is divided up and organised according to type
What are the 5 main data types ?
- Integer
- Float
- Character
- String
- Boolean
What is casting ?
Changing the data type of a variable
How to check length in Python ?
len()
What is concatenation ?
connecting strings of characters next to each other
How to open a file in python ?
- file = open(“FileName.csv”,”a”)
- “a” = append
- “w” = writes
- “r” = read
How to write to a file in python ?
- file.append() = Lists
- file.write() = Files
How to close a file in Python ?
- file.close()
What is SQL ?
Structured Query Language