.. SPDX-FileCopyrightText: 2025 Adrian Chaves .. .. SPDX-License-Identifier: AGPL-3.0-or-later .. _examples: ======== Examples ======== .. _predict-income-example: Example 1 ========= List location buildings for which you can construct a new level, indicating the impact that increasing 1 level of them would have on your country income taking into account the effects of market supply and demand changes on all your buildings on the same market, sorted by income impact: .. code-block:: python from eu5 import Save save = Save.latest() incomes = {} for location in save.played_country.locations.values(): for building in location.buildings.values(): if not building.can_add_level: continue key = f"{building.name} @ {location.name}" incomes[key] = building.predict_income_delta() for key, income in sorted(incomes.items(), key=lambda kv: kv[1], reverse=True): print(f"{key}: {income:+.2f}")