🐍 Lesson 1: Your First Program

Say hello to Python with print()

← Back to Python Basics

💡 What is code?

Code is a set of instructions you give to a computer, written in a language the computer understands. Python is one of those languages — and it's famous for being easy to read.

A computer does exactly what you tell it, in order, one line at a time. Your job as a programmer is to give it clear, correct instructions.

🗣️ The print() command

The most important first command is print(). It tells Python to show something on the screen. You put the message inside the parentheses, wrapped in quotation marks.

print("Hello, World!")

When you run that line, Python shows:

Hello, World!

📌 Why quotes?

The quotation marks " " tell Python "this is plain text — print it exactly." Text inside quotes is called a string. You can use double quotes "like this" or single quotes 'like this' — just match them!

📚 Printing more than once

Each print() shows its message on its own line. Run several in a row to make a list or a poem:

print("Roses are red") print("Violets are blue") print("Python is fun") print("And so are you!")

💬 Comments — notes for humans

A line that starts with # is a comment. Python ignores it completely. Comments are notes you leave for yourself or other people to explain what the code does.

# This is a comment — Python skips it print("But this line runs!") # you can comment at the end too

⚠️ Watch out for tiny mistakes

Common beginner bugs

  • Forgetting a quotation mark: print("Hi)
  • Forgetting the parentheses: print "Hi"
  • Spelling it wrong: Print(...) — Python is case-sensitive, use lowercase print

Don't worry — every programmer makes these. The Practice tab lets you experiment safely!

✅ What you learned

  • print() shows text on the screen.
  • Text inside quotes is called a string.
  • # starts a comment that Python ignores.
  • Python runs your lines top to bottom, one at a time.