completed chapter 6

This commit is contained in:
2022-01-19 14:07:38 -06:00
parent f1d8673f9f
commit dfdcf6712b
6 changed files with 61 additions and 34 deletions
+9
View File
@@ -88,3 +88,12 @@ def delete_customer(id):
if customer_index >= 0:
CUSTOMERS.pop(customer_index)
def update_customer(id, new_customer):
# Iterate the CUSTOMERS list, but use enumerate() so that
# you can access the index value of each item.
for index, customer in enumerate(CUSTOMERS):
if customer["id"] == id:
# Found the customer. Update the value.
CUSTOMERS[index] = new_customer
break