Introduction to Python
Discover why Python is the perfect first programming language and what you will learn in this course.
A new beginning
Welcome to this course on Python programming fundamentals!
Python is one of the world's most preferred programming language and it is known for its simplicity and versatility. It is often recommended as a first language for beginners because its syntax is simple and looks very close to plain English. This allows you to focus on learning programming concepts instead of worrying about complex rules.

Advantages of Python
One of the best things about Python is how many different things you can do with it.
You can start small by writing simple programs and scripts while you’re learning. As you get more comfortable, you can move on to bigger projects like building websites, creating web applications, or even making games and desktop apps.
Python is also very popular for working with data. People use it to analyze numbers, process information, and automate boring or repetitive tasks, so instead of doing the same work again and again, you can let Python do it for you.
So once you learn Python, you can use it on almost any use case without having to relearn it.
Installing Python
Let's quickly install Python in your system so that we can get on with the course!
On Windows, Python is not installed by default, so you must download and install it manually.
Follow these steps to install Python on Windows:
- Visit the official Python website at python.org and download the latest stable version for Windows.
- Run the downloaded installer.
- Important: Check the option “Add Python to PATH” before clicking Install.
- Choose “Install Now” and wait for the installation to complete.
After installation, verify Python by opening Command Prompt and running:
python --version
If Python is installed correctly, the version number will be displayed.
Great! Now that you have Python installed, you're ready to start writing and running Python code. In the next sections, we'll explore how to run Python code using different methods and tools.
Running Your First Line of Python Code
Once Python is installed, you're ready to write and run your first Python program. There are several ways to run Python code, and you can choose the one that feels most comfortable for you.
Interactive mode lets you type Python commands directly into the terminal/command prompt and see the results immediately. This is useful for quick tests and simple experiments.
To start interactive mode, type python or python3 in your terminal/command prompt and once >>> appears, you can start typing Python code:
print("Hello, World!")In script mode, you write Python code in a file with a .py extension and run it from the terminal. This is the standard way to build full Python programs.
Let's first create a hello.py file using any text editor (like Notepad, VS Code, etc.) and write the following code in it:
# hello.py
print("Hello, World!")Now, open your terminal/command prompt, navigate to the directory where you saved the hello.py file, and run the script using the following command:
python3 hello.py
As you might have noticed, both methods produced the same output. You can choose either method based on your needs. Interactive mode is great for quick tests and learning, while script mode is better for writing complete programs.
Running Python Code in an IDE
IDEs provide features like syntax highlighting, code completion, and debugging tools that make writing and managing code easier. They also help you manage your Python scripts in a better way compared to using a simple text editor.
Jupyter Lab is an interactive, browser-based environment where you can write Python code, run it immediately, and see the output right away. It also lets you combine code with notes, explanations, and visualizations, making it ideal for learning and experimentation.
To use Jupyter Lab:
- Install it using pip or pip3 (if it's not already installed):
pip3 install jupyterlab
- Start Jupyter Lab by running:
jupyter lab
This command will open Jupyter Lab in your web browser.
- Create a new Python notebook (a file with the
.ipynbextension).
Enter the following code in a cell and press Shift + Enter to run it:
print("Hello, World!")Jupyter Lab is especially useful for trying out small pieces of code, learning step by step, and working with data and visualizations.
Visual Studio Code also supports Jupyter notebooks through the Jupyter extension. This option is great if you want the interactivity of notebooks along with the features of a full code editor.
Steps to use Jupyter in VS Code:
- Install the Jupyter extension (and optionally the Python extension) from the Extensions view.
- Open an existing
.ipynbfile or create a new one using File → New File… and selecting Jupyter Notebook, or by creating a file with the.ipynbextension. - Choose a Python kernel from the kernel picker in the top-right corner. If needed, install a kernel by running:
pip install ipykernel
- Run notebook cells using the ▶ play button or by pressing Shift + Enter.
Tips:
- Use the Command Palette (Ctrl/Cmd + Shift + P) and search for Jupyter: Create New Blank Notebook to get started quickly.
- If you use multiple Python environments, make sure the selected kernel matches the environment where your packages are installed.
print("Hello, World!")As you continue through the lessons, you'll learn about variables, control flow, functions, data structures, and more. Try running each example in the environment you’re most comfortable with: practice is the best way to learn Python.
Comments in Python
Before we end this introduction lesson, you should get familiar with your first concept in Python: comments.
Comments are programmer-readable notes or annotations in the source code of a Python program and they are ignored by the Python interpreter when the code is executed.
There are two ways you can write comments in Python:
# The line below prints “Hello, World!” to the console print("Hello, World!")2. Multiline comment/Block Comments - A multiline comment is wrapped with a set of triple quotes (""").
""" The line below prints “Hello, World!” to the console """ print("Hello, World!")You will see a lot of comments through the course to clarify certain portions of the code. Make sure to go through them!