Python for Beginners
Your practical, no-fluff guide to learning Python from scratch
Why Python?
Python is consistently ranked as the world's most popular programming language. It powers
everything from Instagram and YouTube to NASA research software and machine learning
models. More importantly for beginners, Python reads almost like plain English, which makes it the
ideal first language. You can write a working program in just three lines, and still scale up to build
professional applications.
Setting Up Your Environment
Before writing any code, you need Python installed on your computer:
Go to [Link]/downloads and download the latest version (3.12 or higher).
Run the installer. On Windows, make sure to check 'Add Python to PATH' before clicking
Install.
Open a terminal (Command Prompt on Windows, Terminal on Mac/Linux) and type: python
--version
If you see something like Python 3.12.x, you're ready to go!
Recommended editor: VS Code (free, from [Link]) with the Python extension
installed.
Chapter 1: Variables & Data Types
A variable is a named container for storing data. Python figures out the type automatically:
# Strings (text) name = "Alice" greeting = 'Hello, World!' # Numbers age = 25 # integer
height = 5.9 # float (decimal) # Booleans (True or False) is_student = True # Print values
to the screen print(name) # Output: Alice print(age + 5) # Output: 30
Chapter 2: Lists & Dictionaries
Lists store ordered collections. Dictionaries store key-value pairs, like a real dictionary maps words
to definitions:
# List fruits = ["apple", "banana", "cherry"] print(fruits[0]) # apple (indexing starts at
0) [Link]("mango") # add an item print(len(fruits)) # 4 # Dictionary person = {
"name": "Bob", "age": 30, "city": "London" } print(person["name"]) # Bob person["email"] =
"bob@[Link]" # add a new key
Chapter 3: Control Flow
Programs make decisions with if/elif/else and repeat tasks with loops:
# If statement score = 85 if score >= 90: print("Grade: A") elif score >= 80: print("Grade:
B") # This prints else: print("Grade: C or below") # For loop — iterate over a list for
fruit in fruits: print(fruit) # While loop count = 0 while count < 5: print(count) count +=
1 # increment by 1
Chapter 4: Functions
Functions let you package and reuse blocks of code. Define once, call many times:
def greet(name, language="English"): """Greet someone in their language.""" if language ==
"Spanish": return f"¡Hola, {name}!" elif language == "French": return f"Bonjour, {name}!"
else: return f"Hello, {name}!" print(greet("Maria", "Spanish")) # ¡Hola, Maria!
print(greet("Pierre", "French")) # Bonjour, Pierre! print(greet("Sam")) # Hello, Sam!
Chapter 5: Your First Real Program
Let's put it all together with a simple to-do list manager:
todos = [] def add_task(task): [Link]({"task": task, "done": False}) print(f"Added:
{task}") def complete_task(index): todos[index]["done"] = True print(f"Completed:
{todos[index]['task']}") def show_tasks(): for i, item in enumerate(todos): status = "✓" if
item["done"] else "■" print(f"[{status}] {i}: {item['task']}") add_task("Buy groceries")
add_task("Learn Python") add_task("Call Mom") complete_task(1) show_tasks()
Next Steps
→ Practice on [Link] or [Link] — free coding challenges.
→ Take Python courses on freeCodeCamp, CS50P (Harvard, free), or Kaggle.
→ Build projects: a weather app, a quiz game, a budget tracker.
→ Read the official Python docs at [Link] — they are excellent.
→ Join communities: r/learnpython on Reddit, Discord servers, Stack Overflow.