Python Modelling

So, both lists and dicts can be used to store multiple values. When should one use which one? Well, a dict is usually used to represent single entity consisting of multiple values, e.g.:

human = {"name": "Alice", "age": 10}

while a list is used to store multiple entities, e.g.:

humans = [
    {"name": "Alice",  "age": 10},
    {"name": "Bob",    "age": 15},
    {"name": "Claire", "age": 20}
}

In this lecture we take a look at how we can use this to create a model of a physical thing which our computer then can perform computations on.

Lecture material