What Is Programming?
Every time you pay a shopkeeper with UPI, check your exam result online or book a train ticket, a computer is following a set of instructions that a person wrote. Writing those instructions is called programming, and the person who writes them is a programmer.
In this lesson you will learn what a program is, why a computer needs very exact instructions, and what programmers do all day. You will also run your first two tiny programs, one in Python and one in JavaScript, without installing anything.
What is a program?
A program is a list of instructions that a computer follows, one after another, to do a job. The instructions are written in a programming language, a special language with strict rules that both people and computers can read.
Think about how you would teach a younger cousin to make tea:
- Pour one cup of water into a pan.
- Put the pan on the stove and switch it on.
- When the water boils, add one spoon of tea leaves.
- Add half a cup of milk and two spoons of sugar.
- Boil for two minutes, then strain into a cup.
This is already very close to a program. It has clear steps, in a fixed order, and each step is small enough to follow. A program for a computer is the same idea, written in a language the computer understands.
Programs are everywhere
You use dozens of programs every day, often without noticing them.
| Where you see it | What the program does |
|---|---|
| UPI payment app | Checks your PIN, moves money, sends you a message |
| Railway booking site | Searches trains, counts free seats, prints your ticket |
| Calculator on your phone | Reads the buttons you press and works out the answer |
| Traffic signal | Changes the lights after a set number of seconds |
| School result website | Finds your roll number and shows your marks |
Some programs are huge and are written by hundreds of people. Others are ten lines long and written in five minutes. In this course you will start with the small ones.
Your first look at code
Here is a real program in Python, one of the most popular languages for beginners. Press the "Try it" button to run it, then change the words and run it again.
print("Namaste! My name is Aarav.")
print("I live in Jaipur.")
print("I am learning to code.")Namaste! My name is Aarav. I live in Jaipur. I am learning to code.
print() is an instruction that means "show this on the screen". The text inside the quotes is shown exactly as you typed it.
Here is the same program in JavaScript, the language that runs inside every web browser:
console.log("Namaste! My name is Aarav.");
console.log("I live in Jaipur.");
console.log("I am learning to code.");Namaste! My name is Aarav. I live in Jaipur. I am learning to code.
In JavaScript, console.log() does the same job as Python's print(). The words are different but the idea is the same. Throughout this course you will often see both languages side by side, so you learn the idea and not only one language's words.
Computers follow instructions exactly
A computer is very fast, but it is not clever on its own. It does exactly what you write, even when that is not what you meant. Look at this program:
print("2 + 3")
print(2 + 3)2 + 3 5
The first line has quotes, so Python treats 2 + 3 as plain text and shows it as it is. The second line has no quotes, so Python treats it as a sum and shows the answer. A person would probably guess what you wanted. A computer never guesses.
The order of instructions matters too. If you swap steps 3 and 5 of the tea recipe, you strain empty hot water into a cup and then add leaves to an empty pan. Programs behave the same way: they run from the top line to the bottom line, one at a time.
What programmers actually do
Many people imagine programmers typing fast all day. In reality, most of the work is thinking. A programmer usually:
- Understands the problem. What exactly should the program do? What goes in and what comes out?
- Plans the steps in plain language before writing code.
- Writes the code in a programming language.
- Tests it with different inputs to see if the answers are right.
- Fixes mistakes, which programmers call bugs. Finding and fixing them is called debugging.
You will practise every one of these steps in this course. You do not need to be a maths topper. If you can follow a recipe and spot when something looks wrong, you can learn to program.
Common mistakes
- Believing you must know maths first. Most beginner programs use only adding, subtracting and comparing. You will learn what you need along the way.
- Trying to memorise everything. Professional programmers look things up every day. Focus on understanding the idea; the exact words come with practice.
- Leaving out the quotes.
print(Hello)does not print the word Hello. Text must be inside quotes:print("Hello"). - Reading without running. You only learn what a program really does by running it and changing it.
Key points
- A program is a list of exact instructions that a computer follows in order.
- Instructions are written in a programming language such as Python or JavaScript.
- Python shows text with
print(); JavaScript usesconsole.log()for the same job. - Text in quotes is shown exactly as written; without quotes, Python may work it out as a sum.
- Programming is mostly thinking: understand, plan, write, test and fix bugs.
Exercise
Open the first Python example in the Try-it editor. Change it so that it prints three lines about you: your name, your city and your favourite food. Then do the same in the JavaScript editor. Finally, add a fourth line in Python that prints the answer to 15 + 27 (the number, not the text).
Show solution
print("My name is Meera.")
print("I live in Kochi.")
print("My favourite food is appam.")
print(15 + 27)My name is Meera. I live in Kochi. My favourite food is appam. 42
console.log("My name is Meera.");
console.log("I live in Kochi.");
console.log("My favourite food is appam.");
console.log(15 + 27);The last line has no quotes around 15 + 27, so the language calculates it and shows 42.
Quick Quiz
1. What is a program?
A program is a set of exact instructions, written in a programming language, that the computer carries out one by one.
2. What does print("4 + 4") show in Python?
The quotes make it text, so Python shows it exactly as written.
3. Which JavaScript instruction does the same job as Python's print() in these lessons?
console.log() shows a value in the console, which is where the Try-it editor collects JavaScript output.
4. What is a bug?
A bug is a mistake in the code. Finding and fixing bugs is called debugging.
Learn Intro to Programming with a mentor
Free lessons get you started. Our Python Programming training adds real projects and code reviews from working developers.
- Project-based learning
- Mentor code reviews
- Free counselling call
