1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Natali [406]
3 years ago
13

1 #Write a function called phonebook that takes two lists as

Computers and Technology
1 answer:
Nesterboy [21]3 years ago
7 0

Answer:

I am writing a Python program.

def phonebook(names, numbers):  #method phonebook that takes two parameters i.e a list of names and a list of phone numbers

   dict={}  #creates a dictionary

   for x in range(len(names)):  # loop through the names

       dict[names[x]]=numbers[x]  #maps each name to its phone number

   return dict #return dictionary in key:value form i.e. name:number

#in order to check the working of this function, provide the names and numbers list and call the function as following:

names = ['Jackie', 'Joshua', 'Marguerite']

numbers = ['404-555-1234', '678-555-5678', '770-555-9012']

print(phonebook(names, numbers))

Explanation:

The program has a function phonebook() that takes two parameters, name which is a list of names and numbers that is a list of phone numbers.

It then creates a dictionary. An empty dictionary is created using curly brackets. A dictionary A dictionary is used here to maps a names (keys) phone numbers (values) in order to create an unordered list of names and corresponding numbers.

for x in range(len(names)):  

The above statement has a for loop and two methods i.e. range() and len()

len method is used to return the length of the names and range method returns sequence of numbers just to iterate as an index and this loops keeps iterating until x exceeds the length of names.

dict[names[x]]=numbers[x]

The above statement maps each name to its phone number by mapping the first name with the first  umber, the second name with the second number and so on. This mapping is done using x which acts like an index here to map first name to first number and so on. For example dict[names[1]]=numbers[1]  will map the name (element) at 1st index of the list to the number (element) at 1st index.

return dict retursn the dictionary and the format of dictionary is key:value where key is the name and value is the corresponding number.

The screenshot of the program and its output is attached.

You might be interested in
Make a hierarchical directory structure under /root that consists of one directory containing three subdirectories.
Alika [10]
You can make a hierarchical directory structure under /root that consists of one directory containing subdirectories  by using cd and mkdir
the mkdir command created the directories while the cd command changes which directory you're currently in
5 0
3 years ago
Match each word to its correct meaning.
MrMuchimi

Answer:

1. active listening             8. an online journal

2. barrier            1. a strategy for showing other people you are interested in what they are saying and that you understand what they are saying and how they feel about it

3. blog          2. anything that interferes with a message being sent or received

4. communication    5. guidelines for courteous electronic communication

5. netiquette         7. the person who creates or composes a message and delivers it either orally or in writing

6. receiver        9.. a personal belief that one should work hard and do a good job

7. sender             3. an online database of Web pages that can be created or edited by anyone (with permission)

8. wiki            6. the person who receives a message

9. work ethic          4. an exchange of information

Explanation:

The answer is as mentioned above. And these are important words from subject Professional Communication. And like when we talk of an exchange of information, we mean communication. And similarly, other words means as being mentioned above.  

5 0
3 years ago
Match each term with the statement that best describes it.
chubhunter [2.5K]

Answer:

Field: A placeholder for information that changes

Explanation:

The are on the page where we write our information. Each page consist of field area where we write text, insert figures and tables.

Table: A grid of columns and rows that you can fill with text and graphics

Explanation:

The arrangement of row and columns to organize the information for the purpose of analyzing and comparing is called Table.

Section break: A formatting mark that divides a document into parts that can be formatted

Explanation:

If we want to divide the document in terms of formatting, we apply section breaks in the document. e.g. If we are writing a document in landscape mode and want to insert few pages in portrait mode then we apply section break.

Header: Text or graphics that appear at the top of every page in a document

Explanation:

The place at the top of the page, where we want to insert some text that should be fixed on each page such as page number, chapter name or book name. We use header.

Manual page break  of the next page: A formatting mark that forces the text following the mark to begin at the top

Explanation:

If we complete the working on one page and want to start work on new page. we apply page break so that any change in formatting of the previous page could not affect the new page.

Footer:Text or graphics that appear at the bottom of every page in a document

Explanation:

The place at the bottom of the page, where we want to insert some text that should be fixed on each page such as page number.

Bibliography: A list of the sources used to create a document

Explanation:

The list of sources that we use to complete our document, from we read some literature to support our arguments. It has been added at the end of the document.

Citation:  A parenthetical reference in the document text that gives credit to a source

Explanation:

The information that we read from other document and insert in our document, assign it a reference to insert in bibliography section.

Margin: The blank area between the edge of the text and the edge of the page

Explanation:

The space between text and edges of the the page from top, bottom, left and right side is called margin.

6 0
3 years ago
Consider the following code:
Elis [28]

Answer:

return tmp;

default:

tmp . token_type = ERROR;

return tmp;

1. In the code, input.GetChar() gets the next character from standard input. If GetToken() is called four times, which of the following inputs will return a token whose type is ERROR?

A. ========

A. =<======

B. ===>====

C. =====<==

D. ======<=

5 0
3 years ago
Suppose that a minus sign in the input indicates pop the stack and write the return value to standard output, and any other stri
Sergio [31]
It’s b just really got to make since an read it right that’s all
7 0
3 years ago
Read 2 more answers
Other questions:
  • When you append a(n) ____ to a command, the command is run in a background process?
    8·1 answer
  • Write a Java program to print the result in the series 10, 15, 20, 25, ..., 50. Hint: You can use an iteration statement for wri
    9·1 answer
  • Can someone pls explain this question??
    7·1 answer
  • An ethernet switch has a ____ table which is updated by ______.
    14·1 answer
  • Operational feasibility, which refers to user acceptance and support, as well as management acceptance and support, is also know
    9·1 answer
  • Put these steps for managing your study time in chronological order. 1 set aside the same time each day 2 Identify the best time
    14·1 answer
  • Write a function findWithinThreshold that identifies the elements of a given array that are inside a threshold value. Takes the
    13·1 answer
  • Explain the concept of “survival of the fittest”
    15·1 answer
  • De acuerdo con las generaciones de la computación, ¿Creen que estamos en la 5ta generación o aun no? y ¿por qué?
    13·1 answer
  • How do you save a document in a format so that any reader can view it?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!