Skip to content
CodeNest

FoundationsLesson 1 of 1910 min

Hello, Python

What Python is, how a program actually runs, and your first working script.

By the end you will be able to

  • Explain what an interpreter does with your code
  • Print text to the console with print()
  • Write comments that explain your intent

Python is a general-purpose programming language. You write plain text instructions in a file, and a program called the interpreter reads them top to bottom and carries them out immediately.

That "top to bottom, one line at a time" model is the single most useful thing to hold in your head as a beginner. There is no hidden starting point and no magic — execution begins at the first line of the file and walks down.

Your first instruction

print() displays a value. The text inside the quotes is a string — a piece of text. Press Run below and watch the output panel.

Python
Output
Hello, Python!
— expected output; press Run to execute it yourself

Everything to the right of print lives inside parentheses. Those parentheses mean call this thing. print is a function, and calling it with a value hands that value over to be displayed.

You can pass several values at once, separated by commas. Python puts a single space between them.

Python
Output
CodeNest 2026
Line one
Line two
— expected output; press Run to execute it yourself

Comments

A # marks the rest of the line as a comment. Python ignores it completely. Comments are for humans reading the code later — usually you.

Python
Output
Visible
— expected output; press Run to execute it yourself

Exercise

Print exactly two lines: first Hello, world!, then your own name on the line below it.

Python
Output

Press Run to execute this code.

Check your understanding

0/2 answered
  1. 1.What does the Python interpreter do with a line starting with #?
  2. 2.What does print("A", "B") display?