Lesson 1 of 30
Lesson 01 — Hello, Python!
Title: Your first Python programs
Description: Meet Python with tiny examples: say hello, print jokes, and make the computer show friendly messages.
Why it matters for kids: Programming starts with one small step. If you can run a file and read the result, you can build bigger ideas later.
1. Say hello
Create a file named hello.py:
print("Hello, Python!")
print("I am learning to code.")
print("Today I will make the computer talk.")Run it:
python hello.py2. Print your own story
print("My robot woke up.")
print("It looked for cookies.")
print("It found one cookie and smiled.")Try changing the words. The computer will repeat exactly what you write between the quotes.
3. Comments are notes
Comments are for humans. Python skips them.
# This line explains the next line.
print("I can leave notes in my code.")
# TODO: Change this animal to your favorite animal.
print("My favorite animal is a panda.")4. Easy examples
print("2 + 2")
print(2 + 2)
print("A cat says meow.")
print("A dog says woof.")
print("A duck says quack.")Question: why does print("2 + 2") show text, but print(2 + 2) shows
the answer?
5. Mini challenge
Click each example to open it.
Example 1
Print Hello!.
Example 2
Print your name.
Example 3
Print your favorite color.
Example 4
Print your favorite animal.
Example 5
Print one funny sentence.
Example 6
Print 2 + 2 as text.
Example 7
Print the answer to 2 + 2.
Example 8
Add one comment before a print line.
Example 9
Print three short lines about a robot.
Example 10
Change one word and run the file again.