Getting Started
4 min read ·
In this Python tutorial, you will learn how to start working with Python on your computer. This lesson is designed for beginners who want to learn Python step by step.
Python is one of the easiest programming languages to start with because its syntax is simple and readable.
Run Python Online
The easiest way to learn Python is by using an online Python editor.
An online editor allows you to:
- Write Python code
- Run code instantly
- View output directly in browser
You do not need to install anything for basic practice.
Example
Output
Pro Tip
Using an online Python compiler is the fastest way for beginners to practice Python examples.
Install Python on Your Computer
If you want to build real Python projects, you should install Python on your system.
Many computers already have Python installed.
Check Python Version on Windows
Open Command Prompt and type:
Example Output
Check Python Version on Linux or Mac
Open Terminal and type:
If Python is installed, the version number will appear on the screen.
Note
Some systems use python while others use python3 command.
Download Python
If Python is not installed, you can download it from the official Python website.
Steps to Install Python
- Open Python official website
- Download latest Python version
- Run the installer
- Select "Add Python to PATH"
- Complete installation
Caution
While installing Python on Windows, always enable the "Add Python to PATH" option.
Write Your First Python Program
After installing Python, you can create Python files using any text editor.
Python files use the
.py extension.Create a File
Create a file named:
Now write the following code inside the file.
Save the file.
Run Python File
Open Command Prompt or Terminal.
Move to the folder where your Python file is saved.
Run this command:
Output
Goal Achieved
You have successfully created and executed your first Python file.
Understanding How Python Works
Python is an interpreted programming language.
This means:
- Python reads code line by line
- The interpreter executes instructions directly
- No separate compilation process is required
This makes Python easier for beginners.
Python Interactive Mode
Python also provides an interactive command line mode.
This allows users to execute Python code instantly without creating files.
Open terminal and type:
or
After running the command, Python interactive shell will start.
Example
In interactive mode:
>>>indicates Python shell- You can test code quickly
- Output appears instantly
Exit Python Shell
To exit interactive mode, type:
and press Enter.
Why Beginners Prefer Python
Python is very popular among beginners because:
- Syntax is simple
- Code is easy to read
- Less complicated than many languages
- Huge community support
- Used in modern technologies
Python is widely used in:
- Web development
- Artificial Intelligence
- Data Science
- Automation
- Machine Learning
Real World Scenario
Many automation scripts used in companies are written in Python because Python reduces development time and simplifies coding tasks.
Python File Extension
Python files are saved using the
.py extension.Example
Exercise
Create a Python file named
student.py.Write a Python program that prints your name and city.