Getting Started with the Python Coding Language
You’re about to meet a friendly tool that powers automation, data analysis, and web apps.
The python coding language is popular because it’s readable, flexible, and fast for real work.
In this chapter, you’ll install Python, set up an editor, run code in REPL, and from a file.
You’ll also write a tiny program for a quick confidence boost.
By the end, you will:
- Install Python 3.11+ and verify it works
- Open a REPL (interactive shell) and run a .py file
- Understand comments and indentation
- Write a small script and a quick greeting exercise
Estimated time: 12, 15 minutes
What You’ll Use Python For
- Automation: rename files, move data, schedule tasks.
- Data: clean CSVs, analyze numbers, plot charts.
- Web: power API backends and websites.
- Learning: because it’s beginner-friendly and used everywhere.
Install Python 3.11+ (Windows, macOS, Linux)
Use the latest stable Python 3.11+.\
Your tools and examples will match modern features.
- Windows
- Download Python from python.org (3.11 or later).
- Important: on the first installer screen, check “Add python.exe to PATH.”
- Finish installation.
- macOS
- Download the macOS installer from python.org (3.11 or later) and run it.
- Alternatively, use Homebrew:
brew install python(installs the latest Python 3).
- Linux
- Use your package manager or download from python.org.
- You’ll likely run Python with the
python3command.
For a step-by-step walkthrough across platforms, see this practical guide to installing 3.11: Install Python 3.11 (platform steps).\
It summarizes Windows, macOS, and Linux approaches.\
It also shows when to use python3.11 directly.
Verify Installation and PATH
Open your terminal (Command Prompt/PowerShell on Windows, Terminal on macOS/Linux) and run one of these:
python --version # On Windows or if 'python' points to Python 3 on macOS/Linux
python3 --version # Common on macOS/Linux
py -3 --version # Windows launcher (optional)
- If you see
Python 3.11.x, you’re set. - If the version is older or not found, your PATH might point to another Python. A quick tip from the community: the Python shown is the one that appears first on your PATH.
Pick Your Editor: VS Code or Thonny
You can write Python in any editor.
Two solid choices for beginners are:
- Visual Studio Code (VS Code)
- Install VS Code from its website.
- Open VS Code, go to Extensions (square icon), search “Python,” install the official Python extension.
Why VS Code? It’s powerful, free, and grows with you. It supports IntelliSense (smart code suggestions), debugging, and virtual environments.
Thonny
- A beginner-friendly IDE with a simple UI, variable view, and an easy debugger. Great if you want “just enough” features to start.
If you can’t install tools yet, run Python in your browser using one of these top Python online IDEs.
Try the examples right away.
Run Code in the REPL (Interactive Shell)
The REPL lets you type a line of Python.
You see results immediately.
It’s perfect for learning.
- Start the REPL:
- Windows: open Command Prompt and run
python(orpy -3) - macOS/Linux: run
python3
You’ll see a prompt like >>>. Try this:
>>> print("Hello, Python!")
Hello, Python!
>>> 2 + 2
4
Press Ctrl+D on macOS or Linux to exit the REPL.
On Windows, press Ctrl+Z, then Enter.
Your First File: hello.py
Let’s create a real script.
You will run it from the terminal.
1) Create a folder named hello and open it in VS Code or Thonny.
2) Create a file hello.py with this content:
print("Hello from a Python file!")
3) Run it from the terminal inside your folder:
python hello.py
python3 hello.py
Expected output:
Hello from a Python file!
That’s your first end-to-end run.
If your terminal says command not found, do not worry.
Your system might use python3 on macOS/Linux.
Windows might use the launcher py -3.
You can list available Python executables.
Then call a specific one (e.g., python3.11).
See this guide: Find and use a specific Python version in terminal.
Tip for python coding
Comments (lines starting with #) explain why your code exists.
Indentation uses spaces at the start of a line.
It defines code blocks.
This is how Python knows which lines belong under an if, for, or def.
You’ll use both constantly in real projects.
Exercise: Ask a Name and Greet the User
Make your script interactive using input().
1) Replace the file with:
name = input("What is your name? ") # input returns a string
print("Nice to meet you, " + name + "!")
2) Run again:
python hello.py # or python3 hello.py
Example session:
What is your name? Maya
Nice to meet you, Maya!
Expected outcome: your program prompts for input and prints a personalized greeting.
Tips for success:
- If nothing happens, the program is waiting for your input, type a name and press Enter.
- If you see a ModuleNotFoundError, you might be running a different interpreter than expected in VS Code. Use the “Python: Select Interpreter” command to pick your Python 3.11+.
- After the greeting exercise, keep practicing with these beginner-friendly Python exercises to build confidence.
Troubleshooting Quick Fixes
pythonopens an older version: trypython3,py -3, orpython3.11. The first Python found on PATH runs when you typepython.- VS Code doesn’t run your script: open the folder of your project, then open
hello.pyand click “Run Python File.” Ensure the status bar shows the correct interpreter (3.11+). - REPL won’t start: on macOS/Linux, run
python3. On Windows, trypy -3. You can also explicitly runpython3.11if installed.
Where You’re Headed Next
Great start.
You’ve set up tools and written a script.
Next, you’ll learn to store data in variables and choose the right data types.
Continue with Variables and Data Types in the Python Coding Language.
As you progress, you’ll make decisions with if and loops in Control Flow Fundamentals for Python Coding.
You will organize reusable code in Functions and Modules for Python Coding Beginners.
You will work with lists, dictionaries, and files in Data Structures and Files in Python Coding.
You will build a tiny app in Build a Mini Project in the Python Coding Language.
Recap Checklist
- Installed Python 3.11+ and verified with
python --versionorpython3 --version - Set PATH correctly (especially on Windows) and know how to select the right interpreter
- Installed VS Code (or Thonny) and ran code in the REPL
- Created and executed
hello.pyfrom the terminal - Wrote comments, understood indentation basics, and used
input()andprint()
Additional Resources
- Ensure Python 3.11 is on PATH (community guidance), Explains how PATH order determines which Python runs and how to check it.
- Find and use a specific Python version in terminal, Tips for discovering available Python executables and calling
python3.11directly.
Congratulations, you’ve taken the first step with the python coding language.\
Onward to variables and data types!