LearnFrenzy
Sign in Take a free test

Getting Started · Lesson 1 of 6

Getting Started with Python: Install, Run and Write Your First Program

Install Python, choose an editor, and write a first program that actually does something — plus the three errors every beginner sees on day one.

9 min read Beginner Updated Nov 5, 2026 Reviewed by Saurabh Samir

If you have written C or Java in college, Python will feel almost too easy at first: no semicolons, no main(), no declaring types. If Python is your first language — even better, you have nothing to unlearn.

Step 1: Install Python

  1. Go to python.org/downloads and download the latest Python 3.
  2. Windows users: on the first screen of the installer, tick "Add python.exe to PATH". Forgetting this is the number one setup problem.
  3. Open Command Prompt (Windows) or Terminal (Mac/Linux) and type:
python --version

If you see something like Python 3.13.1, you are ready. On Mac or Linux you may need python3 instead of python.

No laptop right now? Use Google Colab in your browser — it runs Python for free with nothing to install.

Step 2: Pick an editor

Use VS Code with the official Python extension. It is free, popular in companies, and shows errors as you type. IDLE (which comes with Python) is fine for the first week.

Step 3: Your first program

Create a file called hello.py:

name = input("What is your name? ")
college = input("Which college are you from? ")
print(f"Hi {name}! Welcome to Python from {college}.")

Run it from the terminal, in the folder where you saved the file:

python hello.py

Three things to notice:

  • input() waits for the user to type something and returns it as text.
  • print() shows output on the screen.
  • The f before the quotes creates an f-string, which lets you put variables inside {}. You will use this constantly.

Indentation is not optional

In C and Java, curly braces { } group code. In Python, indentation does that job. Use 4 spaces (VS Code does this automatically when you press Tab).

marks = 72
if marks >= 40:
    print("Pass")        # indented: belongs to the if
print("Result checked")  # not indented: always runs

The three errors you will see on day one

ErrorWhat it meansUsual fix
'python' is not recognizedPython is not in PATHReinstall and tick "Add to PATH", or use py on Windows
IndentationErrorSpacing is inconsistentUse 4 spaces everywhere; do not mix tabs and spaces
NameError: name 'x' is not definedYou used a variable before creating it, or misspelt itCheck spelling — Python is case-sensitive

Read the last line of an error first. Python error messages are long, but the final line tells you the type of error and usually the cause. The line number above it tells you where to look.

Try it yourself: Extend hello.py to ask for the user’s graduation year and print how many years are left until they graduate. (Hint: int(input(...)) turns typed text into a number.)

Common interview questions

Try answering each one aloud before you open it.

1What are the main features of Python?

Easy, readable syntax; interpreted (no separate compile step); dynamically typed; supports procedural, object-oriented and functional styles; a huge standard library and ecosystem (NumPy, pandas, Django, etc.).

2Is Python compiled or interpreted?

It is usually described as interpreted. Technically, source code is compiled to bytecode, which the Python virtual machine then executes line by line.

3Why is indentation important in Python?

Python uses indentation to define code blocks (instead of braces), so incorrect indentation changes the program’s meaning or causes an IndentationError.

Practise this

Build something with it

FAQs

python or python3 — which command should I use?

On Windows usually python (or py); on Mac and Linux usually python3. Use whichever prints a Python 3 version.

Do I need Anaconda?

Not for this track. Plain Python from python.org is enough. Anaconda is useful later for data science.

References & further reading

Finished this lesson?

Mark it complete. Create a free account to save it on every device.

Next lesson

Search LearnFrenzy

Esc

Quick links