Computer programs are a set of step-by-step instructions used to teach the computer how to complete a task.
Computer programs are written using a specific programming language. Nowadays, most programmers would write code using a high-level programming language such as Python, C, C#, Java, Ruby or Basic.
If we were to dissect a computer program, we would find the following elements:
- Reserved Keywords & Built-in Functions
- Identifiers (e.g. for variables and subroutines)
- Values of different data types
- Computing Operators
- Punctuation signs
- Comments/Annotations
Let’s investigate these elements further… Click on the sub sections below to find out more.
For instance, in Python 3.6 there are 33 reserved keywords and a few built-in functions such as print,input,str,int,float.
Here is a non-exhaustive selection of some of the most useful Python reserved keywords and built-in functions.
Reserved Keywords:
| if | elif | else |
| while | break | continue |
| for | in | as |
| import | from | global |
| def | return | local |
| class | del | none |
| try | except | raise |
Built-in Functions:
| input | range | |
| str | int | float |
| min | max | round |
| len | chr | ord |
score = 0
score is the identifier of the variable that stores the score of the player.
Note that a programmer cannot used reserved keywords or built-in functions as identifiers in a program.
For instance in python you cannot have a variable called while as input is a reserved keyword of the language.
Note that, with Object-Oriented Programming languages, you will also use identifiers to give a name to your classes and objects.
Each value as its own data type:
- String values which contain a alphanumerical characters e.g. “James”, “Bond”, “007”
- Integer values which contain whole numbers (positive or negative) such as 365 or -10
- Float values (aka Real) which contain numbers which can have a decimal point such as: 3.14 or 9.81
- Boolean values which are either True or False
Notice how, when using a string value in your code, you have to use “speechmarks”. This is because you do not want your computer to be confused between reserved keywords, identifiers and string values.
- The Assignment Operator =, used to assign a value to a variable or a constant e.g.score = 0
- Arithmetic Operators +, –, *, /, **, //, % used to perform arithmetic calculations
- Comparison Operators <, >, <=,>=, ==, !=
- Boolean Operators and, or, not

Programming languages have their own syntax too. Not using the correct syntax in your code will generate a syntax error. This means that your computer cannot interpret your code and hence will not run it.
In Python, the main punctuation signs are the brackets (, ), [, ], { and } the colon : and the comma ,.
In Python, comments have to start with a # sign. e.g.
#This is a single-line comment
You can also create comments over multiple lines using a triple quote: “””. e.g.
"""
This is a multi-line comment.
You can add much more information here.
These are often used at the top of your code to specify:
- the version number,
- the date the code was last updated
- copyright information.
"""
Your Task
Your task is to identify all the different elements of the short program below, and drag them in the corresponding sections.
Anatomy of a Computer Program – Drag and DropOpen in New Window
Did you like this challenge?
Click on a star to rate it!
Average rating 4.2 / 5. Vote count: 76
No votes so far! Be the first to rate this post.





