Chapter 1: Introduction to Programming
In this chapter, you will learn what programming is, why it matters, and how to write your very
first program. Programming is the foundation of computer science and problem-solving with
technology.
What is Programming?
Programming is the act of writing instructions for a computer to follow. These instructions are
written in programming languages such as Python, Java, or C++. A program tells the
computer what tasks to perform and in what order.
Why Learn Programming?
• It helps you solve problems step-by-step.
• It gives you the power to automate tasks.
• It is used in almost every field: science, business, art, and more.
Basic Terminology
• Variable: A container that stores data (like a box with a label).
• Function: A reusable set of instructions that performs a task.
• Loop: A way to repeat instructions multiple times.
• Syntax: The grammar rules of a programming language.
First Program Example
In Python, the simplest program is:
print('Hello, World!')
This command tells the computer to display the phrase 'Hello, World!' on the screen.
Practice Exercises
• Write a program that prints your name and your favorite hobby.
• Write a program that displays your age on the screen.
Homework & Mini Projects
• Write a program that prints three different sentences on three different lines.
• Write a program that prints a short poem or song lyrics of your choice.
Chapter Review Questions
• True/False: A function is a reusable block of code. (Answer: True)
• Multiple Choice: Which of these is NOT a programming language? (a) Python (b) Java (c)
Banana (Answer: c)
• Short Answer: What does the command print('Hello, World!') do?