Exercises & Solutions

Practice materials from the TA sessions

Schedule

  • Weeks 4-10: Four exercises (~2 weeks each)
  • Week 11: Project structure & debugging
  • Week 12: Reports, documentation & hyperparameter tuning
  • Weeks 13+: Project work

Exercise 1: Contact Manager (Basics)

Python fundamentals, functions, file I/O

Weeks 4-5

Build a command-line contact manager application. Practice working with dictionaries, file handling (JSON), user input, and structuring code into functions.

Exercise 2: Contact Manager (OOP)

Object-oriented programming, classes, refactoring

Weeks 6-7

Refactor your contact manager using object-oriented principles. Learn about classes, methods, encapsulation, and how to structure larger applications.

Exercise 3: ML Regression & Classification

Scikit-learn, model training, evaluation

Weeks 8-9

Introduction to machine learning with scikit-learn. Train regression and classification models, evaluate performance, and understand the ML workflow.

Exercise 4: Neural Networks

Deep learning basics, MLPClassifier, hyperparameters

Week 10

Build and train neural networks using scikit-learn's MLPClassifier. Understand layers, activation functions, and hyperparameter tuning.

Example: Iris Classification Project

Project structure, model comparison, reproducibility

Week 11

A complete example project demonstrating proper structure for your final project. Compares Random Forest, KNN, and Logistic Regression on the Iris dataset with proper organization: src/ modules, main.py entry point, and reproducible results.