Your First Program
Welcome to the practitioner track. Until now we have talked about computers from the outside, the way you might describe a car without ever turning the key. From here on we sit in the driver's seat. The first lesson of …
There is more than one way to understand this. If you have only been taught one, you have been taught less than you deserve.
There is more than one way to understand this. If you have only been taught one, you have been taught less than you deserve.
Welcome to the practitioner track. Until now we have talked about computers from the outside, the way you might describe a car without ever turning the key. From here on we sit in the driver's seat. The first lesson of any programming track in any language is the same. You write a tiny program that makes the computer say hello. Most courses use the English word. We are going to make your computer greet your nani in Urdu. The day you write your first program is the day a new tool joins the family. It deserves to know who lives in the house.
First, the place where we will type. Open Replit dot com on any browser. Replit is a free site that lets you write and run code without installing anything on your computer. This matters in Pakistan. The internet at home may be slow. The laptop you share with three siblings may be old. The one place that always works is a browser tab. Sign up with your Gmail. Click create Repl. Pick Python from the list. Give it a name like pehla-program. The file main dot py opens with a blinking cursor. That cursor is your starting line.
Type one line. print("Assalam o Alaikum, Nani jaan"). That is it. Press the green run button at the top. After a small pause, in the panel on the right, you will see the same words appear. Take a breath. The thing that just happened is not small. You typed Urdu words inside an English programming language inside a machine made in Taiwan running on a server in Singapore, and the screen in front of you in Lahore showed your nani's name. Six countries cooperated for two seconds because you said so. Most adults in Pakistan have never seen this work the other way around. From this minute, you have.
Now make the computer ask, not just say. Below the first line, type your name in the next line. name = input("Aap ka naam kya hai. "). And then a third line. print("Khush amdeed, " + name). Press run. The right panel waits, then prints a question. Type your name into the box that appears, press enter. The screen replies, Khush amdeed, followed by your own name. The computer just had a tiny conversation with you, in your language, in a tool you built five minutes ago. Three lines of code were enough to do it. This is, in miniature, the entire shape of every chat app, every form, every banking screen you will ever build. Input from a human, processing inside, output back.
A small puzzle to get the muscle moving. Change the program so it asks for two things, the user's name and their city. Then print, Khush amdeed [name], [city] se aane wale. Hint, you will need a second input line and a small change to the print line. Try it before reading on. Get it wrong twice. Twice is not failure, twice is the normal cost of learning. The day a programmer stops getting things wrong twice is the day she has stopped learning anything new.
Last thought. The room you wrote your first program in matters. Generations of Pakistani parents have associated learning with a heavy desk, a Mughal era ustaad ji, and silence. Coding is not that kind of learning. The best first program is one written on a charpai with chai cooling next to the laptop, your dadi peering over the screen and saying chee chee yeh kya likha. Welcome her in. Show her the run button. Let her press it once. The day a Pakistani grandmother sees her name appear because her grandchild typed three lines is the day software stops being a foreign idea in this house. The country needs many more such days.
Estimated time: 12 min