Getting Started with Python
What is Python?
Python is a high-level, interpreted programming language created by Guido van Rossum in 1991.
It is popular for its simplicity, readability, and versatility, making it a great choice for beginners and professionals alike.
Python is widely used in web development, data science, artificial intelligence, scripting, and automation.
Why Learn Python?
- Beginner-friendly syntax (close to plain English).
- Rapid development for projects of any size.
- Huge community and open-source ecosystem.
- Popular in data science, AI, and machine learning.
- Powers websites (Django, Flask) and tools at companies like Google, Instagram, Netflix.
Key Features of Python
- Easy to Learn – minimal syntax, highly readable.
- Cross-Platform – runs on Windows, macOS, Linux.
- Interpreted – no need for compilation, runs line by line.
- Extensive Libraries – NumPy, Pandas, TensorFlow, Flask, Django, and more.
- Versatile – from small scripts to enterprise applications.
Getting Started with Python
Follow these steps to install Python and run your first program.
Why Install Python?
Python is required to run and write Python programs.
Most Linux/macOS systems already have it pre-installed, but you may want the latest version.
Installation Commands
# macOS (Homebrew)
brew install python
# Ubuntu/Debian
sudo apt update
sudo apt install python3
# Windows (winget)
winget install Python.Python.3.12
Verify Installation
Run this command to confirm:
python --version
or
python3 --version
You should see the installed version of Python.
Create the File
Open your editor and create a file named hello.py
.
Add the Code
print("Hello, Python!")
Notes
- No need for a
main
method — Python runs top to bottom. - Indentation is critical in Python (use spaces consistently).
Execute the Program
Run your Python script with:
python hello.py
or
python3 hello.py
Expected Output
Hello, Python!
What’s Next?
You’ve written and run your first Python program!
Next steps:
- Print your name.
- Do simple math:
print(2 + 3)
. - Learn about variables, loops, and functions.