New | Code Avengers Answers Python 2
items = ["apple", "banana", "orange"] quantities = [0, 5, 12]
Use the answers above as a template—type them out manually, change variable names, break them on purpose, and fix them again. By the time you finish Python 2, you won’t need to search for answers anymore. You’ll be the one writing the answers. code avengers answers python 2 new
def format_name(first, last): if len(first) > 3 and len(last) > 3: return f"{last.upper()}, {first.upper()}" else: return "Name too short" The .upper() method ensures case-insensitive matching of expected outputs. The f-string creates the exact comma-space format the auto-grader looks for. Challenge 2: "The Inventory Manager" (Lists & Dictionaries) Problem: You are given a list of item names and a separate list of quantities. Combine them into a single dictionary where the key is the item name and the value is the quantity. Then, write code to print only items with quantity > 0. items = ["apple", "banana", "orange"] quantities = [0,
items = ["apple", "banana", "orange"] quantities = [0, 5, 12] inventory = {} for i in range(len(items)): inventory[items[i]] = quantities[i] def format_name(first, last): if len(first) > 3 and

