Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) Write a function called area_code , with three parameters: the first, a dictionary, the

(PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON) (PYTHON)

Write a function called area_code, with three parameters: the first, a dictionary, the second, a string (last name), and the third a string (first name). Assume that dictionary entries are of the form (lastname, firstname) : "pho-nen-umbr". For example, {("Smith", "Bob") : "400-123-1234", ("Rogers", "Alberto") : "561-125-3510"}. Your function should return the area code of the phone number corresponding to the given first and last name. If there is no person with that name in the phonebook, return -1.

image text in transcribed

Write a function called area code, with three parameters: the first, a dictionary, the second, a string (last name), and the third a string (first name). Assume that dictionary entries are of the form (lastname, firstname): "pho-nen-umbr". For example, f("Smith", "Bob"): "400-123-1234", ("Rogers", "Alberto"): "561-125-3510". Your function should return the area code of the phone number corresponding to the given first and last name. If there is no person with that name in the phonebook, return -1. For example: Test Result print (area_code(ft Smith", "Bob")"400-123-1234", ("RogersAlberto"561-125- 400 510", "Smith", Bob) print (area_code "Smith", "Bob"): "400-123-1234", "Rogers", "Alberto) : "561-125- 510","Souza", "JP")) 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago