Topic 1 Introducing core programming concepts

In programming, variable is one of the most core concepts that needs to be understood. A variable is a named storage location in a computer’s memory that can hold a value or data. The name of the variable is used to reference the data stored in that memory location. Variables are used to store values that can be changed or manipulated throughout the course of a program.  For example, let’s say you want to write a program that calculates the area of a school football pitch. You can use variables to store the length and width of the pitch, and then use those variables in a calculation to find the area.

Here’s an example of this calculation in Python code:

A loop is a programming construct that allows a set of instructions to be executed repeatedly, based on a specific condition. A loop enables a programmer to write a single set of instructions that can be repeated multiple times without having to write the same code over and over again.

A “for” loop is used to execute a set of statements a fixed number of times, while a “while” loop is used to execute a set of statements repeatedly as long as a specific condition is true.

Conditional statements, also known as “control structures,” are a type of fundamental programming construct that allow programs to make decisions based on variable values, user input and other factors.

The basic syntax of a conditional statement in most programming languages is as follows:

Data types refer to the different kinds of values that can be stored and manipulated in a program. Each data type defines a set of values and operations that can be performed on those values. Common data types in programming include:

  • Integer: represents whole numbers (e.g. 5, -10, 100)
  • Float: represents decimal numbers (e.g. 3.14, -0.5, 2.0)
  • Boolean: represents true or false values (e.g. True, False)
  • String: represents text or characters (e.g. “hello”, “world”, “123”)