Archived
completed chapter 6
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user