Python 101

The goal of this course is to teach beginners how to solve real life problems using a computer.

Emphasis is given on autonomy (e.g. searching the web for answers), and finding a solution even if it is not the canonical one.

Syllabus

About the course

Python basics

  • Evaluating code
  • Finding help
  • Syntax basics

<2022-09-28 Wed> challenge

This was just about copy-pasting some code

<2022-10-12 Wed> assignment

Do both parts of the first challenge of any year on https://adventofcode.com/.

<2022-10-12 Wed> challenge "Simon says"

See how to solve it here.

<2022-10-19 Wed> assignment

Do both parts of the first challenge of another year on https://adventofcode.com/ or the first few problems of https://projecteuler.net/.

<2022-10-19 Wed> challenge "Collatz"

See how to solve it here.

Data analytics and visualization

  • pandas
  • matplotlib
  • seaborn
  • tidy data
  • DSL
  • grammar of graphics
  • statistics

<2022-10-26 Wed> assignment

<2022-10-26 Wed> challenge

There was no challenge that day

<2022-11-09 Wed> assignment

  • Use seaborn to draw a a funny, or interesting, or absurd, or unexpected, or important graph from a piece of data, either the dataset of the last assignment, or a new one.

<2022-11-09 Wed> challenge "Ice Cream"

See how to solve it here.

Constraint programming

  • Comparative advantage
  • Operations research
  • Linear programming and the simplex algorithm
  • Convex optimization
  • Combinatorics

<2022-11-16 Wed> assignment

  • Solve,relying only on your own code and the standard library, the optimal mining problem:
    • generate a set of random (weight, fee) pairs,
    • within a hard weight limit of, say, 200, try to get the maximum sum of fees
    • try to play with the weight limit, and the weight distribution to see when your solution becomes untractable
    • (optional) try to devise a solution that works for large problem.
  • Solution

    You can find a Pythonic way of solving here.

<2022-11-16 Wed> challenge "Drawer"

See how to solve it here.

<2022-11-19 Sat> challenge "Chemical plant"

Solution to be posted on <2022-11-22 Tue>

<2022-11-23 Wed> assignment

  • Find in your day to day life, or in your past professional experience, a problem that can be optimized using ORtools.
  • You may stay within the Linear Programming framework, or use another solver from the ORtools package.
  • It can be an actual problem, the solution to which will make your day to day life better, or if you are unable to find such a problem, you can build a contrived one from a silly example and solve that. The point is to train your ability to translate business constraints into equations, and to think critically about the solution.
  • It can be very interesting to try to solve a multi-objective problem by devising an objective function that is the sum of competing objectives.
  • See the resources below if you want to know more about this topic.

Satisfiability

Machine Learning

Web scraping

Resources