Free lesson · Module 1, lesson 3 of 8

Meet Python and run your first line

Say what a programming language does, open Python in Google Colab with nothing to install (or on a laptop with Python 3.12 and VS Code), and run a first line that prints a greeting.

The video for this lesson is being prepared

About 10 minutes, narrated in English, Hindi and Odia. The notes and the quiz below are open now.

Lesson notes

Why a programming language

  • A computer's processor understands only tiny machine instructions, stored as 0s and 1s
  • A programming language sits in the middle, like a friend who translates for you at a shop
  • Python (the interpreter) translates your instructions for the machine; its lines read close to English
  • Python is widely used for websites, data work and automating everyday tasks

Two ways to run Python

  • Google Colab, in the browser, nothing to install: search for Google Colab in your browser, sign in with a Google account, make a new notebook, type in a code cell, then press the run button or Shift + Enter
  • Your laptop: install Python 3.12 or newer from the official Python website (on Windows, tick Add python.exe to PATH on the first screen), then Visual Studio Code and its Python extension
  • On the laptop, save your lines in a file ending in .py (for example hello.py) and press the run button at the top right
  • The result appears in the terminal panel at the bottom of Visual Studio Code

The shape of a first line

  • print in small letters (Python treats capital and small letters as different)
  • Round brackets right after it, around what you want shown
  • Text inside matching quotes: "Namaste" or 'Namaste'; the quotes are not printed

Try it yourself

  • print("Hello, India") shows Hello, India
  • print(7 + 5 * 2) shows 17 (multiply before add, no quotes so the value is shown); print((7 + 5) * 2) shows 24
  • Two lines, print("Namaste") then print("Welcome to Python"), show two lines of output, in that order
  • print("Shubha sakala") shows Shubha sakala

The trap

  • Print("Hi"), print(Hi) and print "Hi" all stop with an error. Python is exact: small-letter print, round brackets, quotes around text. An error points at the slip: fix it and run again

Lesson quiz

Checked in your browser. Nothing is sent or saved.

5 questions

Question 1 · easy

Nisha runs this line and Python stops with an error instead of showing Good night.

Print("Good night")

What is the fix?

Question 2 · easy

Ravi wants to try Python on his college library computer. He can use the browser but is not allowed to install anything. Which way should he use?

Question 3 · medium

Asha wants the screen to show Bhubaneswar, but this line stops with an error.

print(Bhubaneswar)

Which line fixes it?

Question 4 · medium

What does this program print?

print("40 + 25")
print(40 + 25)

Question 5 · hard

Ravi runs this program. What happens?

print("Toss won")
Print("Batting first")
print("Target 180")

How a computer follows instructionsNext: Printing text and reading error messages