Write a Python program to simulate an inventory system that updates item quantities and prints the sorted inventory dictionary.
Item name and quantity to add/update separated by space.
Print the updated inventory sorted by item names.
Valid item string and integer quantity
pen 50
{'books': 10, 'pen': 50, 'pencils': 20}
Preload inventory `{'books': 10, 'pencils': 20}`, update or add the new quantity, and sort.
def update_inventory(item, qty):
inv = {'books': 10, 'pen': 30, 'pencils': 20}
# Write your code here
pass
item, qty = input().split()
qty = int(qty)
print(update_inventory(item, qty))Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used