Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I was wondering if you can help me. I need to design a program and write a Psued

ID: 3699109 • Letter: I

Question

I was wondering if you can help me. I need to design a program and write a Psuedo Code that has two parallel arrays: A string array named people that is initialized with the names of seven friends and a String array name phoneNumbers that is initialized with the seven friends phone numbers. The phone number should allow the user to enter a persons name, or part of the persons name. It should then search in the peoples array. If the person is found , it should get the persons phone number from the phoneNumbers array and display it. If the person is not found in the people array, the program should display a message indicating so. Names Candace 404-321-5489 Cross 904-879-6324 Melissa 904-554-8975 Rod 904-562-8750 JAsmine 904-893-4774 Tony 904-621-5896 James 904-521-5987

Explanation / Answer

Please find my answer:

Psuedo Code:

- Initialize String array 'people' with 7 names, and 'phoneNumbers' with their corresponding numbers

-read a string name as searchString to search for

- for each name in people array:

-Check whether name contains searchString

- if contains save the index, else continue

- if contains print the corresponding phone number from phoneNumber array using previously saved index

- if not contains print not found in array, print not found

Python Program:

# create main
def main():

# take in name or part of persons name
person = raw_input("Who are you looking for? > ")

# convert string to all lowercase for easier searching
person = person.lower()

# run people search with the "person" as the parameters
peopleSearch(person)

# create module to search the people list
def peopleSearch(person):

# create list with the names of the people
people = ["john",
"tom",
"buddy",
"bob",
"sam",
"timmy",
"ames"]

# create list with the phone numbers, indexes are corresponding with the names
# people[0] is phoneNumbers[0] etc.
phoneNumbers = ["5503942",
"9543029",
"5438439",
"5403922",
"8764532",
"8659392",
"9203940"]

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote