Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

Can I have some help making a program that has the user append 5 names into a list using a loop? The names need to be in the format LastName-FirstName, with the – separating first/last. Then, using a second loop, split each name based on -. 

Expert Solution
Check Mark
Step 1: Algorithm :

1. Create an empty list called names_list.
2. Create an empty list called split_names_list.
3. Use a loop to repeat the following steps 5 times:
   a. Prompt the user to enter a name in the format "LastName-FirstName" and store it in a variable called name.
   b. Append the name to the names_list.
4. Use a loop to iterate over each name in names_list:
   a. Split each name based on the '-' character and store the resulting last name and first name in variables.
   b. Create a tuple containing the last name and first name.
   c. Append the tuple to the split_names_list.
5. Print "Split Names:" to the console.
6. Use a loop to iterate over each tuple in split_names_list:
   a. Print the last name and first name in the format "Last Name: [last_name], First Name: [first_name]" to the console.
7. End the program.

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education