mobook / MO-book

Hands-On Optimization with Python
MIT License
153 stars 40 forks source link

Issue on page /notebooks/01/production-planning-advanced.html #64

Closed nfbvs closed 11 months ago

nfbvs commented 1 year ago

Incorrect output when parsing nested dictionary

products = {
    "U": {"price": 270, "demand": 40},
    "V": {"price": 210, "demand": None},
}

# print data
for product, attributes in products.items():
    for attribute, value in attributes.items():
        print(f"{product} {attribute:10s} {product}")

The last line should be print(f"{product} {attribute:10s} {value}")