The following problem is a homework assignment (I'll list the problem first then my coding)... Looking forward to hear from you.
Problem: Design a program that has two parallel arrays: a string array named people that is initialized with the names of 7 of your friends, and a string array named phone numbers that is initialized with your friends phone numbers. The program should allow the user to enter a persons name (or part of a persons name). It should then search for that person in the people array. If the person is found, it should get that persons phone number from the phone numbers array and display it. If the person is not found in the people array, the program should display a message indicating so.
Code:
Def main:
#declare variables
Size=7
People=[any 7 common names]
Phonenumbers= [7 phone numbers]
Searchvalue = 0
index = 0
Found = false
Inputpeople = 0
Found =false
#get name from user
InputpeopleInputpeople = raw_input("Enter name you are looking for:"
While found ==false and index >= size-1
If (people[index])== phonenumbers[index]:
Found == true
Else:
Index = index +1
If found ==1:
Print"the phone number is ",phonenumbers
Else:
Print"there is no listing for this number"
Main()