answer.
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
kondaur [170]
2 years ago
7

A contact list is a place where you can store a specific contact with other associated information such as a phone number, email

address, birthday, etc. Write a program that first takes in word pairs that consist of a name and a phone number (both strings). That list is followed by a name, and your program should output the phone number associated with that name.
Ex: If the input is:
Joe 123-5432 Linda 983-4123 Frank 867-5309
Frank
the output is:
867-5309
Python 3 please.

Computers and Technology
1 answer:
Arte-miy333 [17]2 years ago
5 0

Answer:

# The user in prompted for input and stored in userInput

userInput = str(input("Enter the contact: "))

# The user input is splitted and stored in splitUserInput

# splitUserInput is a list because split returns a list

splitUserInput = userInput.split(" ")

# The user is prompt to enter the search contact

# The search contact will have the first letter capitalize

# should it be entered in lower case all through

searchContact = str(input("Enter the search contact: "))

# loop through the list

for i in range(len(splitUserInput)):

   # compare if the string at any value of i

   # is the same as the searchContact

   # we display the string ahead of it

   # by adding 1 to the index

   if(splitUserInput[i] == searchContact):

       print(splitUserInput[i + 1])

Explanation:

A sample screenshot is attached. The code is written in Python 3 and well commented.

The program prompt the user for input then split the input into a list. It then asked for a contact to search for. It begins looping through the list, if the search contact is found at any index, then it prints what is in front of the index.

You might be interested in
A(n) ____ attack is when a system is compromised and used to attack other systems. a. indirect b. direct c. object d. subject
Leviafan [203]

Answer:

a. indirect

Explanation:            

When a system is attacked by a hacker and this infected system is used to attack other systems then it is called indirect attack.  This type of attack is often initiated by a 3rd party computer. It is difficult to find from where this kind of attacks is originated.

Direct attack is when a system is attacked directly by an attacker by installing malicious software or often by getting unauthorized physical access to a computer. So option b is not true.

So the correct option is a. indirect.

4 0
1 year ago
Modify the closest pair of points algorithm so that the separating line L now separates the first n/4 points (sorted according t
Nutka1998 [239]

Answer:

Check the explanation

Explanation:

Kindly check the attached images below to see the step by step explanation to the question above.

3 0
2 years ago
Suppose the algorithms used to implement the operations at layer k is changed. how does this impact services at layers k-1 and k
yarga [219]
If the algorithm is changed for the operations at layer k, the services at k1 will change since the services will be operated after the layer. For the services at k-1, they will not be affected since they are prior to the algorithms.<span />
4 0
1 year ago
Which of these tools can best be used as a self assessment for career planning purposes? a personality test an asset analysis a
Ivahew [28]

Answer:

a goal development checklist

Explanation:

8 0
2 years ago
Propane also known as LP gas, is often mixed with about _______ percent of other gases, such as butane, propylene, and mercaptan
vitfil [10]

Answer:

30

Explanation:

Java - Using a method, how do I "write a program whose input is a character and a string, and whose output indicates the number of times the character appears in the string. Your program must define and call the following method that returns the number of times the input character appears in the input string.

public static int countCharacters(char userChar, String userString)"

4 0
2 years ago
Other questions:
  • Write a program that can convert an integer between 0 and 15 into hex number (including 0 and 15). the user enters an integer fr
    15·1 answer
  • Given: an int variable k, an int array current Members that has been declared and initialized, an int variable memberID that has
    11·1 answer
  • The ________ utility automatically creates duplicates of your libraries, desktops, contacts, and favorites to another storage lo
    6·1 answer
  • A key field is used to _____. enter a password uniquely identify records merge data list the most important information
    12·2 answers
  • A ____ is a software implementation of a computer that executes programs as if it were a real physical computer within the physi
    15·1 answer
  • Your friend Margo is considering what type of display to purchase with her new desktop computer and she asks you for advice. You
    14·1 answer
  • Write the definition of a function named averager that receives a double parameter and return-- as a double -- the average value
    12·1 answer
  • Using Amdahl’s Law, calculate the speedup gain of an application that has a 60 percent parallel component for (a) two processing
    11·1 answer
  • CHALLENGE ACTIVITY 3.7.2: Type casting: Reading and adding values.
    10·1 answer
  • _____________ data is what is translated to digital format so it can be stored in a computer.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!