A. Text-based and block-based programming
Text-based programming- when you write code or instruction for a computer using words
and symbols. (ex. Python/Pycharm)
Block-based programming- this is when you write code or instruction for a computer by
connecting blocks instead of typing text code.(ex. mBlock)
Programming is the process of designing and writing instructions for a computer to perform
specific tasks. Computer program- program is a collection of code that performs a specific
task when executed by a computer. A programmer is the person who writes the code that
makes it possible for a program to work efficiently.
B. Variables and data types
A variable is used to store data that can be used in your program.
Here are some rules when naming a variable:
- A variable name:
1. must start with a letter or the underscore character.
2. can only contain letters, numbers and underscores.
3. cannot start with a number
4. cannot contain space
5. is case sensitive meaning the variable “Section” is different to variable “section”
A data type refers to a specific type of data or value stored in a variable.
The two commonly used data types are as follows:
1. String type (str)- used to store non-numeric data such as letters, words and alpha
numeric data.
2. Numeric type- used to store numerical values.
a. Integer(int)- contains positive and negative whole numbers.
b. Float- contains positive and negative values with decimal numbers.
c. Sequence- used to store multiple items in 1 variable.
III. Operators
- These are special symbols that perform operations on variables and values.
1. Arithmetic operators- used to perform mathematical operations on variables and
values.
2. Comparison operator- used to compare variables and values.
IV. Conditional Statements
- Used to control the flow of a program based on whether a condition is true or false.
If statement- used to perform a line of code if the condition is true.