Demonstrate your dictionary mastery!
Create a function count_words(text) that takes a string and returns a dictionary with each word as a key and its count as the value.
Use text.lower().split() to get lowercase words. Loop through and use dict.get(word, 0) + 1 to count.
Create a function calculate_average(grades) that takes a dictionary of student names and their grades (list of numbers) and returns a dictionary with each student's average grade.
Use dict comprehension: {name: round(sum(scores)/len(scores), 1) if scores else 0 for name, scores in grades.items()}
Create a function merge_inventory(inv1, inv2) that merges two inventory dictionaries. If an item exists in both, add the quantities together.
Start with result = inv1.copy(), then loop through inv2 and add using result[key] = result.get(key, 0) + value.