What is Python?
Python is a high-level, interpreted programming language known for its readability and versatility. Itβs used in web development, data science, automation, AI/ML, and more.
Hello World
Python
Output
Variables and Types
Python is dynamically typed β no need to declare types.
Python
Output
Strings
Python
Output
Lists
Python
Output
Dictionaries
Python
Output
Conditionals
Python
Output
Loops
Python
Output
Functions
Python
Output
Classes
Python
Output
Error Handling
Python
Output
File I/O
# Write
with open("notes.txt", "w") as f:
f.write("Hello from Python")
# Read
with open("notes.txt", "r") as f:
content = f.read()
print(content)Modules and Imports
import os
from datetime import datetime
from collections import Counter
# Standard library examples
print(os.getcwd()) # current directory
print(datetime.now()) # current time
print(Counter("banana")) # Counter({'a': 3, 'n': 2, 'b': 1})Useful Built-ins
Python
Output
Next Steps
- Setting Up Python β Get Python installed on your machine
- Setting Up Python with uv β Modern tooling with uv