📖 Scenario: You are part of a software development team working on a project that has accumulated some technical debt. Your team wants to organize and manage this technical debt effectively to improve the code quality and maintainability.
🎯 Goal: Build a simple structured list of technical debt items, categorize them by priority, and create a plan to address them step-by-step.
📋 What You'll Learn
Create a dictionary called technical_debt with exact entries for debt items and their descriptions
Add a variable called priority_levels listing the priority categories
Use a loop with variables item and description to create a new dictionary debt_by_priority grouping items by priority
Add a final step to include a summary string management_plan describing the approach
💡 Why This Matters
🌍 Real World
Managing technical debt is essential in software projects to keep the codebase healthy and maintainable over time.
💼 Career
Software engineers and project managers use technical debt management to prioritize work and improve software quality.
Progress0 / 4 steps
1
Create the technical debt dictionary
Create a dictionary called technical_debt with these exact entries: 'Legacy code': 'Old code that is hard to maintain', 'Lack of tests': 'Insufficient automated tests', 'Outdated dependencies': 'Libraries that need updating', 'Poor documentation': 'Missing or unclear documentation'.
Software Engineering
Hint
Use curly braces {} to create a dictionary with the exact keys and values given.
2
Add priority levels list
Create a list called priority_levels with these exact strings in order: 'High', 'Medium', 'Low'.
Software Engineering
Hint
Use square brackets [] to create a list with the exact strings in order.
3
Group technical debt by priority
Create an empty dictionary called debt_by_priority. Then use a for loop with variables item and description to iterate over technical_debt.items(). Inside the loop, assign priorities as follows: if item is 'Legacy code' or 'Lack of tests', set priority to 'High'; if item is 'Outdated dependencies', set priority to 'Medium'; otherwise, set priority to 'Low'. Add each item to the list in debt_by_priority under its priority key. Initialize the list if the key does not exist yet.
Software Engineering
Hint
Use a dictionary to group items by priority. Check each item and assign priority accordingly. Use if priority not in debt_by_priority to initialize lists.
4
Add a management plan summary
Create a string variable called management_plan with this exact text: 'Focus first on high priority technical debt items, then address medium and low priority items to improve code quality over time.'
Software Engineering
Hint
Assign the exact text to the variable management_plan using quotes.
Practice
(1/5)
1. What is technical debt in software engineering?
easy
A. Shortcuts or problems in code that need fixing later
B. Money spent on buying software tools
C. The total number of lines of code in a project
D. The time taken to write documentation
Solution
Step 1: Understand technical debt and compare options
Technical debt refers to shortcuts or quick fixes in code that make future changes harder. Only "Shortcuts or problems in code that need fixing later" correctly describes technical debt as code problems needing fixing later.
Final Answer:
Shortcuts or problems in code that need fixing later -> Option A
Hint: Think of debt as code shortcuts needing future repair [OK]
Common Mistakes:
Confusing technical debt with project cost
Thinking it means code size or documentation time
Assuming it is about hardware or tools
2. Which of the following is a correct practice in managing technical debt?
easy
A. Regularly identifying and prioritizing debt items
B. Ignoring code problems until the project ends
C. Adding more features without fixing existing issues
D. Deleting all old code without review
Solution
Step 1: Identify good practices and evaluate options
Managing technical debt means regularly finding and prioritizing problems to fix. Regularly identifying and prioritizing debt items describes this process correctly, while others ignore or worsen debt.
Final Answer:
Regularly identifying and prioritizing debt items -> Option A
Quick Check:
Good management = identify and prioritize [OK]
Hint: Good management means regular checks and prioritizing fixes [OK]
Common Mistakes:
Thinking ignoring problems is okay
Believing adding features solves debt
Assuming deleting code blindly helps
3. Consider this code snippet representing technical debt items with priorities:
debt = {"bug1": 3, "bug2": 1, "bug3": 2}
# Lower number means higher priority
sorted_debt = sorted(debt.items(), key=lambda x: x[1])
print([item[0] for item in sorted_debt])
What will be the output?
medium
A. ['bug1', 'bug3', 'bug2']
B. ['bug3', 'bug1', 'bug2']
C. ['bug2', 'bug3', 'bug1']
D. ['bug2', 'bug1', 'bug3']
Solution
Step 1: Trace the sorting logic
The dictionary has bug1=3, bug2=1, bug3=2 (lower number = higher priority). sorted() by value (x[1]) ascending orders: bug2 (1), bug3 (2), bug1 (3). List comprehension gets ['bug2', 'bug3', 'bug1'].
Final Answer:
['bug2', 'bug3', 'bug1'] -> Option C
Quick Check:
Sorted by priority ascending = ['bug2', 'bug3', 'bug1'] [OK]
Hint: Sort by priority number ascending to find order [OK]
Common Mistakes:
Sorting in descending order by mistake
Confusing keys and values in sorting
Misreading priority meaning
4. This code tries to remove fixed technical debt items from a list:
debt = ["bug1", "bug2", "bug3"]
fixed = ["bug2"]
for item in fixed:
debt.remove(item)
print(debt)
What is the output?
medium
A. ['bug3']
B. ['bug1', 'bug2', 'bug3']
C. Error: list.remove() called on missing item
D. ['bug1', 'bug3']
Solution
Step 1: Trace the list removal
Loop over fixed=["bug2"], remove "bug2" from debt=["bug1", "bug2", "bug3"], resulting in ["bug1", "bug3"], printed as ['bug1', 'bug3'].
Final Answer:
['bug1', 'bug3'] -> Option D
Quick Check:
Removed fixed items = ['bug1', 'bug3'] [OK]
Hint: Removing fixed items updates list correctly [OK]
Common Mistakes:
Expecting no change in list
Thinking it causes an error
Removing wrong items by mistake
5. A team has a list of technical debt items with severity scores:
debt = {"bug1": 5, "bug2": 0, "bug3": 3, "bug4": 0}
# Severity 0 means no real issue
# They want to create a new dict with only real issues
real_issues = {k: v for k, v in debt.items() if v != 0}
print(real_issues)
What will be printed?
hard
A. {'bug1': 5, 'bug2': 0, 'bug3': 3, 'bug4': 0}
B. {'bug1': 5, 'bug3': 3}
C. {'bug2': 0, 'bug4': 0}
D. {}
Solution
Step 1: Trace the dict comprehension filtering
Keeps pairs where v != 0, excluding bug2:0 and bug4:0, resulting in {'bug1': 5, 'bug3': 3}.
Final Answer:
{'bug1': 5, 'bug3': 3} -> Option B
Quick Check:
Filtered dict excludes zero severity items [OK]
Hint: Filter out zero values to keep real issues [OK]
Common Mistakes:
Including zero severity items by mistake
Confusing keys and values in comprehension
Expecting empty dict instead
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.