</>
Skip to content
Python lessons (3/45)

Python — Get Started

Two ways to run Python

1. Interactive mode — type a line, see the result instantly:

$ python
Python 3.12.1 (main) …
>>> print("hello")
hello
>>> 2 + 3
5

The >>> prompt reads your line, executes, prints. Perfect for experiments — a calculator that also runs programs.

2. Script mode — save a .py file and run it:

$ python hello.py

Real programs live in files; the shell is your scratchpad.

Installation

  1. Download from python.org/downloads
  2. Windows: tick "Add python.exe to PATH" on the first installer screen — the step everyone skips and regrets
  3. Verify in any terminal:
python --version
Python 3.12.1

Mac/Linux users: python3 may be the correct command instead of python.

No installation at all? Online interpreters run Python in the browser for the whole early part of this course.

Your first program

Create hello.py:

print("Hello, world!")
print("I am learning Python")

Run it:

$ python hello.py
Hello, world!
I am learning Python

print() displays whatever you give it — your Swiss-army output tool. Strings need quotes; numbers don't:

print(42)          # 42
print("42")        # 42  (but this one is text!)
print(3 + 4)       # 7   — math happens first
print("3 + 4")     # 3 + 4 — quoted = literal text

A slightly real program

name = input("What's your name? ")
age = input("How old are you? ")

print("Nice to meet you,", name)
print("Next year you'll be", int(age) + 1)

What you'll see

What's your name? Ada
How old are you? 36
Nice to meet you, Ada
Next year you'll be 37

Three new ideas in six lines:

PieceMeaning
input(...)Pause, ask the user, return what they typed
name = ...Store the answer under a variable
int(age)input always returns text — convert before doing math

That last conversion is the classic first-week bug. age + 1 with "36" crashes or misbehaves because "36" is characters, not a number.

Editors

Any text editor works; VS Code + its Python extension gives you syntax coloring, error squiggles and an integrated terminal — the standard free setup.

Mini Practice

  1. Run python --version; note whether you needed python3
  2. In the interactive shell compute 365 * 24, then exit with exit()
  3. Write hello.py printing three lines about yourself
  4. Extend the example above to greet by name twice
  5. Break it deliberately: remove int() around age and watch the error message — read it fully; errors are documentation written just for you

Next: syntax →

Related Topics

Frequently Asked Questions about Get Started

What is Get Started in Python?

Get Started is a fundamental concept in Python. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Get Started?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Get Started.

Why is Get Started important in Python?

Get Started is essential for Python development. Understanding this concept will help you write better code and solve real-world problems more effectively.