Yes, absolutely! The zip() function is super flexible and can handle more than two iterables.
When you pass multiple iterables to zip(), it will create tuples where each tuple contains an element from each of the input iterables, in corresponding order.
For example, let's say you also want to add the available stock for each furniture item:
furniture = ['table', 'chair', 'rack', 'shelf']
price = [100, 50, 80, 40]
stock = [10, 25, 5, 12]
for item, amount, quantity in zip(furniture, price, stock):
print(f'The {item} costs ${amount} and we have {quantity} in stock.')
This would produce an output like:
The table costs $100 and we have 10 in stock.
The chair costs $50 and we have 25 in stock.
The rack costs $80 and we have 5 in stock.
The shelf costs $40 and we have 12 in stock.
As you can see, zip() effortlessly combined the three lists furniture, price, and stock into trios of related data.
Keep up the great work! Let me know if anything else pops up.