Implement function lookup() that implements a phone book lookup application. You
ID: 3547243 • Letter: I
Question
Implement function lookup() that implements a phone book lookup application. Your functiontakes, as input, a dictionary representing a phone book. Int the dictionary, tuples containing first and last names of individual (the keys) are mapped to strings containing phone numbers(the values)
Your function should provide a simple interface through which a user can enter the first and last names of an individual and obtain the phone number asiigned to that individual.
You must take into consideration that more than one person can have the same first and last name. A modified dictionary that maps a tuple to a list of phone numbers could be used to implement a more realistic phone book.
Explanation / Answer
may be this helpfulll for you def adjust_salary(employee_key, raise_ammount):def runner():# Async call to lookup the Employee entity employee_entity_future = db.get_async(employee_key)# Create and put a SalaryAdjustment entity in parallel with the lookup adjustment_entity = SalaryAdjustment(parent=employeeKey) adjustment_entity.adjustment = raise_amount db.put_async(adjustmentEntity)# Fetch the result of our lookup to make the salary adjustment employee_entity = employee_entity_future.get_result() employee_entity.salary += raise_amount# Re-put the Employee entity with the adjusted salary. db.put_async(employee_entity) db.run_in_transaction(runner)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.