PROGRAMMING FOUNDATIONS — BITE■SIZED + EXPANDED
1. WHAT IS PROGRAMMING?
Programming is the process of giving instructions to a computer to perform tasks.
A program is a set of step-by-step commands that the computer follows.
Example:
• If you tell a computer: “Add 2 + 3,” you write code that performs that addition.
Real-life example:
• Following a cooking recipe is like running a program — step-by-step instructions.
-------------------------------------------------------------
2. KEY PROGRAMMING CONCEPTS (EXPANDED)
A. VARIABLES
A variable stores data that can change during program execution.
Think of a variable as a container (box) that holds information.
Examples:
x=5
name = "Stephen"
age = 20
Why it matters:
Variables help the program remember information.
-------------------------------------------------------------
B. DATA TYPES
Data types define the kind of information a variable stores.
Common types:
• Integer → whole numbers
• Float → decimal numbers
• String → text
• Boolean → True/False values
Example:
temperature = 36.7 (float)
isStudent = True (boolean)
school = "Unima" (string)
-------------------------------------------------------------
C. OPERATORS
Operators allow you to perform operations on data.
Types:
• Arithmetic (+, -, *, /)
• Comparison (==, >, <)
• Logical (and, or, not)
Example:
marks = 80
passed = marks > 50 # True
-------------------------------------------------------------
D. CONDITIONAL STATEMENTS
These allow the program to make decisions.
Example:
if age >= 18:
print("Adult")
else:
print("Minor")
-------------------------------------------------------------
E. LOOPS
Loops repeat actions.
Two types:
1. for loop → repeats a known number of times
2. while loop → repeats until a condition changes
Example:
for i in range(5):
print(i)
-------------------------------------------------------------
F. FUNCTIONS
A function is a reusable block of code.
Example:
def add(a, b):
return a + b
print(add(2, 3)) # 5
-------------------------------------------------------------
3. PROGRAMMING LANGUAGES (EXPANDED)
A. Python
• Simple, readable language
• Great for beginners
• Used in AI, data science, web apps
Example:
print("Hello world")
-------------------------------------------------------------
B. Java
• Strongly typed and structured
• Used for Android apps & enterprise systems
Example:
[Link]("Hello world");
-------------------------------------------------------------
C. JavaScript
• Runs in web browsers
• Used for interactive websites
Example:
[Link]("Hello world");
-------------------------------------------------------------
D. C++
• Fast and powerful
• Used for robotics, gaming, operating systems
Example:
cout << "Hello world";
-------------------------------------------------------------
4. HOW TO START PROGRAMMING (SIMPLE GUIDE)
Step 1: Choose one language (Python recommended)
Step 2: Install a code editor (VS Code recommended)
Step 3: Write small programs daily
Step 4: Build simple projects
Step 5: Practice consistently — 20 minutes daily is enough
-------------------------------------------------------------
END OF DOCUMENT