Term 1 · AI Foundations & Python for AI · Lesson 3 of 30All lessons
AI CourseSyllabax AI · Class 9Term 1 · AI Foundations & Python for AI
Term 1 · AI Foundations & Python for AI · Lesson 3

Getting Started with Python

5 min read30 practice questions15-question quiz

Learn how to write simple Python code, print messages, and see how computers understand your words.

A friendly opening + what we'll learn

Hello, young coder! We are going to start a fun adventure with Python. You will learn how to tell a computer to say hello, do simple maths, and store information. Think of Python as a magic notebook where every line you write becomes a small spell. By the end of this lesson you will write your first program, see the result on the screen, and understand the basic words programmers use. Ready? Let’s open the notebook and begin!

Core idea explained simply

Python is a language that computers understand. You type commands, and the computer follows them one by one. The most common first command is print. When you write print("Hello, world!") the computer shows the words Hello, world! on the screen. It is like shouting a message on a megaphone so everyone can hear. You can also store numbers or words in variables and later ask the computer to show them. Think of a variable as a little box in your school bag where you keep a note.

✦ The Big Idea

Python lets you write simple instructions that the computer follows step‑by‑step, and the print command shows the result.

Going a little deeper

Let’s meet two new friends: strings and integers. A string is any text you put inside quotes, like "Cricket" or "Mango Lassi". An integer is a whole number such as 7 or 2024. You can add two integers with the + sign, just like adding runs in a cricket match. If you try to add a string and a number, Python will politely tell you it cannot mix them. So, always keep numbers with numbers and words with words. Now you know the basic building blocks for many programs.

◆ Worked Example 1
  1. Open the Python editor (like IDLE or an online notebook).
  2. Type the following line and press Enter: print("Good morning, friends!")
  3. The screen shows: Good morning, friends!
  4. You just told the computer to speak a greeting. This is your first Python program.
◆ Worked Example 2
  1. In the same editor, type these three lines one after another: age = 10 name = "Aarav" print(name, "is", age, "years old.")
  2. Press Run.
  3. The screen shows: Aarav is 10 years old.
  4. Here you stored a number (10) and a word (Aarav) in variables, then printed them together.
📖 AI in the Real World

Riya loves watching cartoons on YouTube. She asks her voice assistant, "Play my favourite cartoon" and the assistant finds the video instantly. Behind the scenes, the assistant uses Python code to understand her words, look for the right video, and start playing it. Just like Riya’s assistant, you can write tiny Python programs that talk to you, count your cricket scores, or remind you of the next festival. Every time you see a smart feature, remember a simple Python spell is often at work.

🧪 Try It Yourself
  1. Take a sheet of paper and draw three boxes. Label them name, age, favorite sport.
  2. Write a short sentence in each box, e.g., "Anaya", "9", "Kabaddi".
  3. Now imagine you are a computer. Speak the sentence using the print idea: "Anaya is 9 years old and loves Kabaddi".
  4. Share your sentence with a family member and ask them to guess which words are strings and which are numbers.
💡 Remember
  • print shows text on the screen.
  • Strings need quotes, integers do not.
  • Variables are like labeled boxes that hold values.
  • Python follows commands line by line, just like a recipe.
📝 Homework
  1. With a parent, open a free online Python editor (like repl.it).
  2. Write a program that stores your favourite festival, the month it occurs, and prints a short celebration message.
  3. Run the program and note what appears on the screen.
  4. Take a screenshot or write down the result and show it to your teacher next class.
✦ variable✦ print✦ string✦ integer✦ code✦ interpreter