0
0
MLOpsdevops~30 mins

Cost allocation and optimization in MLOps - Mini Project: Build & Apply

Choose your learning style9 modes available
Cost Allocation and Optimization in MLOps
📖 Scenario: You work in a team managing machine learning projects. Each project uses cloud resources that cost money. Your manager wants to see how much each project costs so they can optimize spending.
🎯 Goal: Build a simple Python program that stores project costs, sets a budget limit, calculates which projects exceed the budget, and prints those projects for review.
📋 What You'll Learn
Create a dictionary called project_costs with exact project names and costs
Create a variable called budget_limit with the exact value 1000
Use a dictionary comprehension called over_budget_projects to find projects costing more than budget_limit
Print the over_budget_projects dictionary
💡 Why This Matters
🌍 Real World
Teams managing machine learning projects need to track cloud resource costs to avoid overspending.
💼 Career
Understanding cost allocation helps MLOps engineers optimize budgets and report expenses clearly to stakeholders.
Progress0 / 4 steps
1
Create the project costs dictionary
Create a dictionary called project_costs with these exact entries: 'ProjectA': 850, 'ProjectB': 1200, 'ProjectC': 950, 'ProjectD': 1300
MLOps
Need a hint?

Use curly braces {} to create a dictionary with keys as project names and values as costs.

2
Set the budget limit
Create a variable called budget_limit and set it to the integer value 1000
MLOps
Need a hint?

Just assign the number 1000 to the variable budget_limit.

3
Find projects over the budget
Use a dictionary comprehension called over_budget_projects to select projects from project_costs where the cost is greater than budget_limit
MLOps
Need a hint?

Use {project: cost for project, cost in project_costs.items() if cost > budget_limit} to filter projects.

4
Print the projects over budget
Write a print statement to display the over_budget_projects dictionary
MLOps
Need a hint?

Use print(over_budget_projects) to show the filtered projects.