Why Python? Installation & First Program
Why Python? Installation & Your First Program
Python is the most in-demand programming language in the world right now — and for good reason. It's the language behind Instagram, YouTube, Spotify, and virtually every major AI breakthrough of the last decade. It's also the friendliest language for beginners and powerful enough for experts.
Here's why Python won the programming world:
Readability first. Python was designed to read like English. Compare sorting a list in Python vs Java:
# Python
numbers = [3, 1, 4, 1, 5, 9, 2, 6]
numbers.sort()
print(numbers)
// Java — same operation, much more ceremony
import java.util.Arrays;
int[] numbers = {3, 1, 4, 1, 5, 9, 2, 6};
Arrays.sort(numbers);
System.out.println(Arrays.toString(numbers));
One language for everything. Python handles web development, data science, AI/ML, automation, scripting, APIs, and more. You learn one language and unlock multiple career paths.
The AI ecosystem. Every major AI library — TensorFlow, PyTorch, scikit-learn, LangChain, Hugging Face — is Python-first. If you're serious about AI, Python is non-negotiable.
Installing Python
Option 1: Python.org (Recommended for most)
- Go to python.org/downloads
- Download Python 3.12 or newer
- Important on Windows: Check "Add Python to PATH" before installing
- Verify: open Terminal/Command Prompt and type
python --version
Option 2: Anaconda (For data science focus)
Anaconda bundles Python with 250+ data science libraries pre-installed. Download from anaconda.com
Option 3: Google Colab (Zero installation)
If you want to code right now without installing anything:
- Go to colab.research.google.com
- Free Python environment in your browser
- Perfect for this course
Choosing Your Editor
VS Code (Recommended for this course)
- Free, from Microsoft
- Install the Python extension
- Best debugging tools
PyCharm
- More powerful Python-specific features
- Free Community edition available
Jupyter Notebook / JupyterLab
- Interactive cells — run code in chunks
- Perfect for data science and experimentation
Your First Python Program
Create a file called hello.py and write:
print("Hello, World!")
Run it: python hello.py
Output: Hello, World!
That's it. No classes, no main function, no boilerplate. Just the code you need.
Python's Interactive Mode
Python has a REPL (Read-Eval-Print Loop) — type code and see results instantly:
$ python
>>> 2 + 2
4
>>> "Hello" + " " + "World"
'Hello World'
>>> 10 / 3
3.3333333333333335
>>> 10 // 3 # Integer division
3
>>> 10 % 3 # Modulo (remainder)
1
>>> 2 ** 10 # Exponent
1024
Use the REPL constantly while learning. It's the fastest way to test ideas.
Python Comments
# This is a single-line comment — Python ignores it
"""
This is a multi-line string, often used as a docstring
to document functions and classes.
"""
x = 42 # inline comment
Getting Help
Python has incredible built-in documentation:
help(print) # shows full documentation for print()
dir(str) # lists all methods available on strings
type(42) # shows the type of any value
A Program That Does Something Useful
Let's write a small program that actually solves a problem — calculating your BMI:
# BMI Calculator
print("=== BMI Calculator ===")
weight_kg = float(input("Enter your weight in kg: "))
height_m = float(input("Enter your height in meters: "))
bmi = weight_kg / (height_m ** 2)
print(f"\nYour BMI: {bmi:.1f}")
if bmi < 18.5:
print("Category: Underweight")
elif bmi < 25:
print("Category: Normal weight")
elif bmi < 30:
print("Category: Overweight")
else:
print("Category: Obese")
In about 15 lines, you have a real program with user input, math, decision-making, and formatted output. This is Python in a nutshell — expressive and practical.
Python Enhancement Proposals (PEP 8)
PEP 8 is Python's style guide. The most important rules:
# Good Python style (PEP 8)
user_name = "alice" # snake_case for variables
MAX_RETRIES = 3 # UPPER_CASE for constants
def calculate_area(radius): # snake_case for functions
return 3.14 * radius ** 2
# Bad Python style
userName = "alice" # camelCase (JavaScript style)
CalculateArea = lambda r: 3.14 * r ** 2 # unnecessary lambda
What's Next
In the next lesson, we go deep on Python's type system — understanding the difference between integers, floats, strings, booleans, and None, and why it matters for writing correct programs.
The foundation is set. Let's build.
Get this course's notes on Telegram!
Free cheat sheets, summaries & practice exercises