Computer Programming

What Is Programming

July 27, 2026 • 7 min read • By SIBRAH Team

👨‍💻
S
SIBRAH Team
July 27, 2026
Computer Programming 7 min read

What Is Programming? – Variables, Data Types, and the Art of Giving Instructions

Programming is the act of giving precise, step-by-step instructions to a computer to perform a task. In this post, we will start from the very beginning – what a program is, what variables and data types are, and why computers need everything spelled out in exact detail.

1. A Program Is a Recipe

A computer program is a list of instructions that the computer follows to transform input into output. The only difference from a cooking recipe is that computers have no common sense. A human cook knows "spread butter" implies using a knife. A computer needs every tiny step spelled out. This is why programming requires precision.

2. Variables – Labeled Boxes for Data

A variable is a named storage location in the computer's memory. Think of it as a labeled box – you put a value inside, and you can change that value later.

Real-world analogy: A whiteboard with a label. You write "age = 25." Later, you erase and write "age = 26." The label (variable name) stays the same; the content changes.

age = 25

print(age)   # outputs 25

age = 26

print(age)   # outputs 26

3. Data Types – Different Kinds of Values

Data Type

What it stores

Example

Allowed operations

Integer (int)

Whole numbers

42, -7, 0

+, -, *, /, //, %

Float

Decimal numbers

3.14, -0.001

+, -, *, /

String (str)

Text (characters)

"Hello", "123"

concatenation (+), repetition (*)

Boolean (bool)

True or False

True, False

and, or, not

List (or array)

Collection of items

[1, 2, 3], ["apple", "banana"]

indexing, appending, iterating

Important: A string containing digits ("123") is not the same as the integer 123. You cannot add "10" + 5 – you must first convert the string to an integer.

4. Naming Variables – Rules and Conventions

  • Names can contain letters, digits, and underscores (_).
  • Cannot start with a digit. 1st_name is invalid; first_name is valid.
  • Case-sensitive: age and Age are different variables.
  • Cannot use reserved keywords (like if, while, for, class).
  • Use meaningful names: number_of_students instead of n.
  • In Python, use snake_case: user_age. In JavaScript/Java, use camelCase: userAge.

5. Input and Output

name = input("What is your name? ")

print("Hello, " + name + "!")

 

# input() always returns a string. Convert to use as a number:

age_str = input("Enter your age: ")

age = int(age_str)   # converts "25" to 25

6. Your First Program

# Get two numbers from the user

num1 = int(input("Enter first number: "))

num2 = int(input("Enter second number: "))

 

# Calculate the sum

total = num1 + num2

 

# Display the result

print("The sum is:", total)

7. Common Beginner Mistakes

Mistake

Why it fails

Fix

Forgetting quotes around a string

name = Alice treats Alice as a variable name.

Use quotes: name = "Alice"

Trying to add string and integer

"10" + 5 gives a type mismatch error.

Convert string first: int("10") + 5

Using a variable before assigning a value

print(score) before score = 0.

Always initialize variables first.

Mixing up = and ==

if x = 5 (assignment) instead of if x == 5 (comparison).

Use == for equality checks.

Summary

Term

Definition

Program

A sequence of instructions that a computer executes.

Variable

A named container for storing data.

Data type

Classification of data (integer, float, string, boolean, etc.).

Integer

Whole number (e.g., 42, -7).

String

Sequence of characters (text).

Boolean

True or False value.

Review Questions

  1. Why must you convert the result of input() to a number before doing arithmetic?
  2. What is the difference between the integer 5 and the string "5"?
  3. Write a simple program (in words or pseudocode) that asks for a person's height in centimetres and converts it to metres (divide by 100), then prints the result.

Share this article

Facebook Twitter WhatsApp LinkedIn

Related Articles

⚙️
Computer Programming

Functions and Methods

🔀
Computer Programming

Control Flow in Programming

Want to Learn More?

Enroll in one of our professional ICT training courses today.

View Our Courses

Stay Ahead with SIBRAH

Subscribe for tech tips, course updates and exclusive offers.