Concept explainers
This is the question I am stuck on -
A personal phone directory contains room for first names and phone numbers for 30 people. Assign names and phone numbers for the first 10 people. Prompt the user for a name, and if the name is found in the list, display the corresponding phone number. If the name is not found in the list, prompt the user for a phone number, and add the new name and phone number to the list.
Continue to prompt the user for names until the user enters quit. After the arrays are full (containing 30 names), do not allow the user to add new entries.
Use the following names and phone numbers:
Name | Phone # |
---|---|
Gina | (847) 341-0912 |
Marcia | (847) 341-2392 |
Rita | (847) 354-0654 |
Jennifer | (414) 234-0912 |
Fred | (414) 435-6567 |
Neil | (608) 123-0904 |
Judy | (608) 435-0434 |
Arlene | (608) 123-0312 |
LaWanda | (920) 787-9813 |
Deepak | (930) 412-0991 |
This is the code I have done so far but I know I am missing pieces or messing it up fully -
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 2 images
- def read_flights(flights_source: TextIO, routes: RouteDict) -> FlightDir: """Return the flights from flights_source, including only the ones that have an entry in routes. >>> from io import StringIO >>> flight_src = StringIO(TEST_FLIGHTS_SRC) >>> actual = read_flights(flight_src, TEST_ROUTES_DICT_FOUR_CITIES) >>> actual == TEST_FLIGHTS_DIR_FOUR_CITIES True """ flights = [] src_index = FLIGHT_DATA_INDEXES["Source airport"] dst_index = FLIGHT_DATA_INDEXES["Destination airport"] # Complete this function. for line in routes_source:arrow_forwardin PERL programming: Consider the list (784,785,754,1035,776,775). Please extract from the list the numbers that ends to 5. Please use one statement.arrow_forwardPYTHON PROGRAMMING LANGUAGE Create a new text document called names.txt (this is done by hand - not using programming) with the following names: Adam, Bryan, Charlie. Each name should be followed by a hard return (do not store them in a list). Main Function. Write a program where the user enters a name. Using the read function, check to see if the name is in the text document. If it is, respond back to the user the name is found within the list. Read Function. The read function should return the contents of the text document as a list. Write Function. The write function should take the list and override the file with the new names list in reverse alphabetical order with a hard return after each name. EXAMPLEPlease enter a name: AdamAdam is found in the list.Enter another name (Y/N): YPlease enter a name: AndrewSorry, Andrew was not found in the list. Would you like to add it? (Y/N): YAndrew has been added to the list.Enter another name (Y/N): N LIST EXAMPLEadambryancharlie Final…arrow_forward
- Le Chef Heureux Restaurant has 20 tables that can be reserved at 5 p.m., 7 p.m., or 9 p.m.Design a program that accepts reservations for specific tables at specific times; the user entersthe number of customers, the table number, and the time. Do not allow more than four guests pertable or invalid table numbers or times. If an attempt is made to reserve a table already taken,reprompt the user. Continue to accept reservations until the user enters a sentinel value or allslots are filled. Then display all empty tables in each time slot. Pseudocode and flowchart (RAPTOR please) if possible. Do not write it in any particular language, that is not required.arrow_forwardWhat's wrong with this cell?arrow_forwardWrite a stored procedure named displayCountryMessage(). The displayCountryMessage () should receive one input argument for the country name and then based on that input argument, display a short message and the name of the country. Otherwise, if the country does not exist in the country table, then the procedure should display an appropriate message. For example, if I call the displayCountryMessage() procedure and pass it “France”, then it will display the message “France exists in the Country table”. If I call the displayCountryMessage()procedure and pas it “AAAAA”, then it will display the message “AAAAA does NOT exist in the Country table”.arrow_forward
- To capitalize a word in vim, place the cursor on the first letter of the term, then type x p.arrow_forwardI want to read the numbers from random_number.txt and then display the number and display total of the number and the number of random number read from the file and the average of this numberarrow_forwarde) Search for instances of the string password (all cases) using cat and grep. $ f) Search for the number of instances of the string password (all cases) using cat, grep and wc. $ From your above commands, can you determine if there are case-sensitive instances of the string password in the wordlist-probable.txt file? How do you know?arrow_forward
- Hi Team, Can you please help me in solving this query asap. Question- Use the python. to write a program.. The first problem has three requirements. First, write a program that will find the 450th prime number. After every 50 prime numbers in the search for the 450th, print the number of prime numbers found up to that point to the console. Include an explanation of what the iteration means (i.e., 150 prime numbers found so far). When you have identified the 450th prime number, print a statement to the console that indicates what this program was looking for and the solution. All prime numbers are odd, other than the number two. This eliminates a lot of candidates. The first step is to create an array of odd numbers, then test whether they are prime or not. Do this while you identify the remaining 449 prime numbers. You could use the modulo to test the values. How many divisors need to be checked before ruling a number out? You can review this list of prime numbers to ensure that you…arrow_forwardTurn the following code into a procedure. Pass the input file and the amount of PM 10 to the procedure. It will print the city name and the pollution values for all cities that have that much PM 10 pollution or more.arrow_forwardA is a variable that contains an address of another variable as its value. Use the operator to get the value stored in the address. Write your answer here.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education