Batch 9 Python.......
Batch 9 Python.......
PYTHON
Batch no.09
A.sriya, 242FA05006
K.Srithanvi, 242FA05033
K.arun kumar, 242FA05038
P.prashanth, 242FA05055
def
1. Introduction get_customer_by_name(customers,
name):
Efficient customer data handling is """Returns the dictionary for the
crucial in business applications. This customer with the given name."""
report details Python for customer in customers:
implementations for retrieving, if customer.get("name") ==
updating, and merging customer name:
information stored as dictionaries return customer
within a list. The report also return None
introduces sorting and filtering
functionalities to improve usability. TEST CASES
Programs to solve def test_get_customer_by_name():
# Test Case 1: Customer
2.PROBLEM SOLVEING exists with the given name
THROUGH PYTHON customers = [
{"name": "Alice", "age": 30,
A. RETRIEVING A "email": "[email protected]"},
CUSTOMER BY NAME {"name": "Bob", "age": 25,
"email": "[email protected]"}
The following function searches for
]
a customer by name and returns their result =
details: get_customer_by_name(customers,
"Alice")