Python For Kids · Lesson

Your First Python Code

Write and run your very first Python program.

Lesson 4 of 411 steps

Your First Python Code is a free Python For Kids lesson on CoddyKit. This is lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Python For Kids learning path, and your progress syncs across the web and the CoddyKit app. The Python For Kids course includes 4 lessons in total.

Writing Your First Code

Your First Python Code

Welcome to your first Python lesson! Today, you'll write your very first Python program. Let's get started and see how fun coding can be!

Your First Python Code — illustration 1

What You Need

Before we begin, make sure you have Python installed and a code editor ready. If you need help setting these up, check out the previous lessons.

Opening Your Code Editor

Open your code editor (like IDLE or Visual Studio Code). We're going to write our first line of Python code here.

You can use our online editor and compiler while using the application.

Writing Your First Line of Code

Let's write a simple program that tells the computer to say hello. Type the following line into your editor:

print("Hello, Python!")

Understanding the Code

The print() function tells Python to display the text inside the quotes. In this case, it will show:

Hello, Python!

Using the Online Editor

Since we will use our online editor during the training, you will not need to create an additional project on your computer.

Saving Your Program

Save your file with a name like hello.py. The .py extension tells your computer that it's a Python file.

Running Your Program

Now, let's see your program in action! 

  1. Open the Command Prompt (Windows) or Terminal (Mac/Linux). 
  2. Navigate to the folder where you saved hello.py. 
  3. Type python hello.py and press Enter.

You should see:


Hello, Python!

Adding More Messages

Let's make your program say more things. Add another print() line below the first one:

Run your program again. Now you'll see two messages!

print("Hello, Python!")
print("I'm excited to learn programming!")

Great Job!

You’ve written and run your first Python program! Keep practicing by adding more print() statements and see what you can create.

Your First Python Code — illustration 11
Free to start

Learn Python with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
22
Lessons
94

Frequently Asked Questions

Is the “Your First Python Code” lesson free?

Yes — the full text of “Your First Python Code” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Python For Kids course, upgrade to CoddyKit PRO. The Python For Kids course includes 4 lessons in total.

What will I learn in “Your First Python Code”?

Write and run your very first Python program. You practise Python For Kids with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Python For Kids?

No prior experience is required. Python For Kids on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 4 of 4.

How long does the “Your First Python Code” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Python For Kids lesson?

Yes. Every Python For Kids lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. What is Programming?
  2. Why Learn Python?
  3. Tools and Environment Setup
  4. Your First Python Code
← Back to Python For Kids