DEV Community

Mohammed Swaleh
Mohammed Swaleh

Posted on Edited on

Python 101: Your Complete Beginner's Guide from Setup to Running Programs

Introduction

Python is one of the world's most popular programming languages and is widely used in software development, data analytics, artificial intelligence, cybersecurity, automation, and scientific research.

Its simple syntax, readability, and large ecosystem make it an ideal first programming language for beginners.

However, many beginners struggle before they even write their first line of code. Common challenges include installing Python, configuring development tools, navigating folders, and running Python files successfully.

This guide focuses entirely on helping complete beginners set up Python and run their first programs. By the end of this tutorial, you will be able to:

  • Install Python
  • Verify your installation
  • Use the Python interpreter
  • Navigate folders using PowerShell
  • Install Visual Studio Code (VS Code)
  • Create Python files
  • Run Python scripts
  • Use Jupyter Notebook, Google Colab, and Kaggle

Understanding the Python Ecosystem

Before installing anything, it is important to understand that Python itself is different from the tools used to write code.

Python is the programming language and interpreter that executes your code.

Development environments such as:

  • Visual Studio Code (VS Code)
  • Jupyter Notebook
  • Google Colab
  • Kaggle Notebooks
  • Sublime Text

are simply places where you write and run Python code.

A useful analogy is:

  • Python = Engine
  • VS Code, Jupyter, Colab = Vehicles that use the engine

Installing VS Code alone does not install Python. Both must be available if you want to work locally on your computer.


Installing Python

The first step is installing Python.

Windows Installation

  1. Visit the Python Downloads page:

https://www.python.org/downloads/

  1. Download the latest stable version.

  2. Run the installer.

  3. Wait for the installation to complete.

Adding Python to PATH is one of the most important steps. Without it, your computer may not recognize Python commands in PowerShell or Command Prompt.


Verifying the Installation

After installation, open PowerShell.

Run:

python --version
Enter fullscreen mode Exit fullscreen mode

Example output:

Python 3.15.0
Enter fullscreen mode Exit fullscreen mode

If a version number appears, Python was installed successfully.

If an error appears, Python was either not installed properly or was not added to the PATH.


Using the Python Interactive Shell

After installation you can run Python directly.

Open PowerShell and type:

python
Enter fullscreen mode Exit fullscreen mode

You should see something similar to:

Python 3.15.0
>>>
Enter fullscreen mode Exit fullscreen mode

This is called the Python Interactive Shell.

Try executing:

print("Hello World")
Enter fullscreen mode Exit fullscreen mode

Output:

Hello World
Enter fullscreen mode Exit fullscreen mode

To exit the Interactive Shell:

quit()
Enter fullscreen mode Exit fullscreen mode

or

exit()
Enter fullscreen mode Exit fullscreen mode

You will return to PowerShell.


Essential PowerShell Commands

Before running Python files, you must know how to navigate folders.

Display Current Folder

pwd
Enter fullscreen mode Exit fullscreen mode

Example:

C:\Users\Student
Enter fullscreen mode Exit fullscreen mode

View Files and Folders

dir
Enter fullscreen mode Exit fullscreen mode

Example:

Documents
Downloads
Python101
Enter fullscreen mode Exit fullscreen mode

Change Directory

cd Documents
Enter fullscreen mode Exit fullscreen mode

or

cd Python101
Enter fullscreen mode Exit fullscreen mode

These commands help you locate and execute Python programs.


Installing Visual Studio Code

Although Python can be used directly from PowerShell, most developers use an editor.

Visual Studio Code (VS Code) is one of the most popular free code editors available.

Download VS Code from:

https://code.visualstudio.com/

Installation Steps

  1. Download VS Code.
  2. Install it.
  3. Open VS Code.
  4. Open the Extensions panel.
  5. Install:
  • Python (Microsoft)
  • Jupyter (Microsoft)

These extensions provide syntax highlighting, IntelliSense, notebook support, debugging tools, and code execution features.


Creating Your First Python Project

Create a folder named:

Python101
Enter fullscreen mode Exit fullscreen mode

Open the folder inside VS Code.

Create a file named:

main.py
Enter fullscreen mode Exit fullscreen mode

The .py extension identifies the file as a Python script.

Enter the following code:

print("Hello World")
Enter fullscreen mode Exit fullscreen mode

Save the file:

Ctrl + S
Enter fullscreen mode Exit fullscreen mode

Your first Python program is now ready.


Running a Python File from PowerShell

Open PowerShell.

Navigate to the folder containing your program.

Example:

cd Documents\Python101
Enter fullscreen mode Exit fullscreen mode

Run the file:

python main.py
Enter fullscreen mode Exit fullscreen mode

Output:

Hello World
Enter fullscreen mode Exit fullscreen mode

Congratulations!

You have successfully run your first Python program.


Running Python Files inside VS Code

VS Code provides an easier way to execute programs.

  1. Open your project folder.
  2. Open main.py.
  3. Click Run Python File.
  4. The terminal opens automatically.
  5. Output appears in the terminal.

Example:

print("Python is working!")
Enter fullscreen mode Exit fullscreen mode

Output:

Python is working!
Enter fullscreen mode Exit fullscreen mode

VS Code automatically handles many tasks that beginners usually perform manually.


Running Python in Jupyter Notebook

Jupyter Notebook allows Python code to be executed in individual cells.

Install Jupyter:

python -m pip install notebook
Enter fullscreen mode Exit fullscreen mode

Launch Jupyter Notebook:

jupyter notebook
Enter fullscreen mode Exit fullscreen mode

A browser window opens automatically.

Create a notebook and enter:

print("Hello from Jupyter")
Enter fullscreen mode Exit fullscreen mode

Run the cell using:

Shift + Enter
Enter fullscreen mode Exit fullscreen mode

Output:

Hello from Jupyter
Enter fullscreen mode Exit fullscreen mode

Jupyter Notebook is especially useful for experimentation, learning, and data analysis.


Running Python in Google Colab

Google Colab is Google's cloud-based notebook environment.

Visit:

https://colab.research.google.com

Sign in using a Google account.

Create a new notebook and enter:

print("Hello from Colab")
Enter fullscreen mode Exit fullscreen mode

Run the code using:

Shift + Enter
Enter fullscreen mode Exit fullscreen mode

Output:

Hello from Colab
Enter fullscreen mode Exit fullscreen mode

Advantages of Google Colab

  • No installation required
  • Free to use
  • Accessible from any device
  • Automatic saving to Google Drive

It is ideal for beginners who do not want to install software immediately.


Running Python in Kaggle Notebooks

Kaggle provides another cloud-based environment for running Python.

Visit:

https://www.kaggle.com/

Create an account and then:

  1. Open Notebooks.
  2. Create a new notebook.
  3. Enter Python code.
  4. Execute code cells.

Kaggle is particularly useful when working with datasets and machine learning projects.


Common Setup Problems and Solutions

Problem 1: Python Command Not Found

Error

'python' is not recognized as an internal or external command
Enter fullscreen mode Exit fullscreen mode

Solution

Reinstall Python and ensure:

Add Python to PATH
Enter fullscreen mode Exit fullscreen mode

is selected during installation.


Problem 2: Cannot Find Python File

Error

can't open file main.py
Enter fullscreen mode Exit fullscreen mode

Solution

Navigate to the correct folder:

cd Python101
Enter fullscreen mode Exit fullscreen mode

Then run:

python main.py
Enter fullscreen mode Exit fullscreen mode

Problem 3: Changes Do Not Appear

Cause

The file was not saved.

Solution

Press:

Ctrl + S
Enter fullscreen mode Exit fullscreen mode

before executing the script.


Problem 4: VS Code Cannot Detect Python

Solution

Press:

Ctrl + Shift + P
Enter fullscreen mode Exit fullscreen mode

Type:

Python: Select Interpreter
Enter fullscreen mode Exit fullscreen mode

Choose the Python version you installed.


Recommended Beginner Workflow

A practical workflow is:

  1. Install Python.
  2. Verify installation.
python --version
Enter fullscreen mode Exit fullscreen mode
  1. Install VS Code.
  2. Create a project folder.
  3. Create a .py file.
  4. Write code.
  5. Save using Ctrl + S.
  6. Run using:
python filename.py
Enter fullscreen mode Exit fullscreen mode
  1. Practice using Jupyter Notebook or Google Colab.

Following this workflow will help you build confidence and avoid common beginner mistakes.


Conclusion

Setting up a Python development environment is the first and most important step in becoming a Python programmer.

In this guide, you learned how to install Python, verify the installation, use PowerShell commands, create Python files, and run programs using VS Code, Jupyter Notebook, Google Colab, and Kaggle.

Many beginners assume programming starts with writing code. In reality, successful programming starts with understanding your tools and knowing how to execute programs correctly.

Once you can confidently install Python, create files, and run programs, you are ready to begin learning core Python concepts such as variables, data types, operators, user input, and program logic.

For now, focus on mastering setup and execution. Every experienced Python developer started exactly where you are today—with a simple "Hello World" program.


Top comments (0)