Topics 1-3 Flashcards
What’s a high-level language?
Designed for humans, easier to learn/use.Incl. libraries of pre-built automations (‘functions’). E.g. Python, Java, C++.
Must be translated into machine language for CPU to understand.
What’s a low level language?
Close to what computer speaks, difficult for humans to read. Include assembly languages & machine code.
What is an Interpreter?
Translates high-level language into machine code one instruction at a time, immediately executes that instruction, then moves to the next & repeats.
No intermediate Program is saved.
What is a Compiler?
Translates complete high-level program into machine language program. Complete translation before execution. Result can be executed repeatedly without further translation.
5 steps in the Program Development Cycle?
- Design the program
- Write the code
- Correct syntax errors
- Test the program
- Correct logic errors
Explain 2 ways to design/visualise a program:
Using Pseudocode (describing steps in plain speech as though to a person).
With a Flowchart diagram.
What is Pseudocode?
Pseudocode is a model computer program written in informal language that has no syntax rule
What 3 step process does a computer program usually follow?
Input | processing | output
Input: data received by program while running.
Processing: Perform operation on input (e.g. mathematical calculation).
Output: Produce desired information/response.
Instruct python to produce an output using the ____ function.
print(desired output)
How can I explain what’s going on in my code?
Comments are identified with a leading hash character. Python ignores everything to right of this on the line. Used to explain & identify components of the program for yourself & future users
Why use comments?
Comments (Python; indicated by leading hash character) are ignored by translator program; meant for humans. Offer explanation of parts of the program, enabling easier understanding, editing etc. For others and yourself, when you come back later.
How can I enter multi-line comments?
’’ Triple quotation marks:’’’
“”” These are used often to document the code; e.g. right at the top of a program describing functions, inputs & outputs”””
What’s a variable?
A value stored in the computers memory; that the program can store, update & retrieve.
variable = data… what is the equals sign here?
The assigment operator. It creates and/or updates the variable, named/addressed with vaue to its left, and assigning it the value to its right.
Python has strict variable naming rules:
Variable names:
- cannot be a Python keyword
- cannot contain spaces (use underscores for variable_name)
- first character must be a letter or an underscore
- otherwise contain only letters, digits, or underscores
- are case sensitive.