0
0
MLOpsdevops~10 mins

Cost optimization at scale in MLOps - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the budget alert threshold to 80%.

MLOps
budget_alert_threshold = [1]
Drag options to blanks, or click blank then click option'
A8
B80
C1.2
D0.8
Attempts:
3 left
💡 Hint
Common Mistakes
Using 80 instead of 0.8 causes errors because the system expects a decimal.
Using 8 or 1.2 are invalid percentages.
2fill in blank
medium

Complete the code to create a cost optimization rule that stops idle compute instances after 30 minutes.

MLOps
optimization_rule = {'action': 'stop', 'condition': 'idle_time > [1]'}
Drag options to blanks, or click blank then click option'
A30
B60
C15
D45
Attempts:
3 left
💡 Hint
Common Mistakes
Using 60 or 45 minutes delays stopping too long.
Using 15 minutes stops instances too early.
3fill in blank
hard

Fix the error in the code to calculate monthly cost savings by multiplying hourly savings by hours in a month.

MLOps
monthly_savings = hourly_savings [1] 720
Drag options to blanks, or click blank then click option'
A-
B+
C*
D/
Attempts:
3 left
💡 Hint
Common Mistakes
Using + or - changes the meaning and causes wrong results.
Using / divides instead of multiplying.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps instance IDs to their cost if cost is greater than 100.

MLOps
costly_instances = {id: cost for id, cost in instances.items() if cost [1] [2]
Drag options to blanks, or click blank then click option'
A>
B100
C<
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Using < or 50 filters the wrong instances.
Swapping the operator and value causes logic errors.
5fill in blank
hard

Fill all three blanks to create a dictionary of instance names in uppercase mapped to their usage hours, filtering only those with usage over 200 hours.

MLOps
filtered_usage = [1]: [2] for [3], usage in usage_data.items() if usage > 200
Drag options to blanks, or click blank then click option'
Aname.upper()
Busage
Cname
Dinstance
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'instance' instead of 'name' causes variable errors.
Not converting name to uppercase changes the key format.
Using wrong values for keys or values breaks the dictionary.