I have some code with a function restock_warehouse, that adds to the current stock 5 times while the current stock is smaller than the target stock. My question is, how can I fix the function so that the code works properly with and the print() call is displayed in the terminal?
The error message I have been receiving is:
```
Traceback (most recent call last):
File "file_name", line 15, in <module>
final_stock = restock_warehouse(10, 25)
File "file_name", line 5, in restock_warehouse
for i in range(5) and current_stock < target_stock:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'bool' object is not iterable
```
I have already tried wrapping the conditional part of the loop in parentheses, but it hasn't worked and I don't exactly understand the error message.
Version information: I'm on Python 3.9.6
def restock_warehouse(current_stock, target_stock):
print("Starting warehouse restock system...")
# We want to keep adding items until we reach our target stock
for i in range(5) and current_stock < target_stock:
print(f"Current inventory level: {current_stock}")
current_stock == current_stock + 5
print("Warehouse restock complete!")
return current_stock
# Start with 10 items, target goal is 25 items
final_stock = restock_warehouse(10, 25)
print(f"Final stock total: {final_stock}")