Python Essentials

Lesson 1 of 27

Hello, Python

Python is one of the most useful languages you can learn: it reads almost like English, it's used everywhere (websites, data, automation, AI), and you can run it right here in this lesson — no installation, nothing to set up. Let's start the way every programmer starts: making the computer say something.

Your first program

The print() function displays whatever you put inside its brackets. Press Run:

Python — Try it Yourself
Loading editor…
Output
Click Run to execute the code.

Two lines of code, two lines of output. Each print() puts its text on its own line. The text inside the quotes is called a string — literally a string of characters.

Why the quotes matter

The quotes tell Python "this is text, not code." Without them, Python tries to interpret the words as instructions and fails. Try running this to see the error, then fix it by adding quotes:

Python — Try it Yourself
Loading editor…
Output
Click Run to execute the code.

You'll get a NameError — Python looked for something named Hello and found nothing. Wrap it in quotes ("Hello") and it works. Errors are normal and useful — they tell you exactly what Python didn't understand. You'll read a lot of them, and that's how you learn.

The mistake beginners make

Forgetting a quote, or mismatching them: print("Hello) or print('Hello"). Python needs a matching pair — both double quotes, or both single. Single and double both work; just be consistent within one string.

Your turn

Python — Try it Yourself
Loading editor…
Output
Click Run to execute the code.

The # starts a comment — Python ignores everything after it on that line. Comments are notes to humans; they don't run.


Your turn

  1. Run the first example. Change the text to your own name and run it again.
  2. Delete a quote on purpose and run it — read the error message. Then fix it. Getting comfortable with errors is half of learning to code.
  3. Add two more print lines of your own.

Key points

  • print() displays whatever is inside its brackets.
  • Text goes in matching quotes (single or double) — it's called a string.
  • # starts a comment, which Python ignores — notes for humans.
  • Errors are normal and helpful — they tell you what Python didn't understand.

Q&A · 0

Enrol to ask questions and join the discussion.

No questions yet — be the first to ask.