Python Suppose a list empList consists of sublists with [id,fullName] empList = [ ] Ask the user to enter their ID and name Put that information into empList Ask the user to enter a name Print the ID of the person with that name OR “Name not found” if that name isn’t in empList. Ask the user to enter a ID Remove that entry from empList OR print “No delete – name not found” if the ID isn’t there. Ask the user to enter an ID. If empList has an entry with that ID, ask the user for a newFullName and replace the existing entry in empList Print the entries in List, one per line so that the output looks like this: ID Name 123 Joe Brown 235 Molly Smith Please use format to do this printing
Python Suppose a list empList consists of sublists with [id,fullName] empList = [ ] Ask the user to enter their ID and name Put that information into empList Ask the user to enter a name Print the ID of the person with that name OR “Name not found” if that name isn’t in empList. Ask the user to enter a ID Remove that entry from empList OR print “No delete – name not found” if the ID isn’t there. Ask the user to enter an ID. If empList has an entry with that ID, ask the user for a newFullName and replace the existing entry in empList Print the entries in List, one per line so that the output looks like this: ID Name 123 Joe Brown 235 Molly Smith Please use format to do this printing
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Python
Suppose a list empList consists of sublists with [id,fullName]
empList = [ ]
- Ask the user to enter their ID and name
- Put that information into empList
- Ask the user to enter a name
Print the ID of the person with that name OR “Name not found” if that name isn’t in empList. - Ask the user to enter a ID
Remove that entry from empList OR
print “No delete – name not found” if the ID isn’t there. - Ask the user to enter an ID.
If empList has an entry with that ID, ask the user for a newFullName and replace the existing entry in empList - Print the entries in List, one per line so that the output looks like this:
ID Name
123 Joe Brown
235 Molly Smith Please use format to do this printing
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
Step 1
empList = [] while 1: print("1.Add user to list\n2.Search user by name\n3.Remove user by ID\n4.Enter the user ID for update\n5.Print the users \n6.Exit") choice = int(input("Enter the coice : ")) if choice == 1: id = input("Enter the user ID : ") name = input("Enter the user name : ") empList.append([id,name]) elif choice == 2: nametofind = input("Enter the user name : ") found = False; for i in empList: if nametofind in i: found = True print("ID {} Name {}".format(i[0],i[1])) break if not found: print("Name not found") elif choice == 3: idtoremove = input("Enter the user ID : ") found = False keyfound = [] for i in empList: if idtoremove in i: found = True keyfound=i break if found: empList.remove(keyfound) else: print("No Delete - ID not found") elif choice == 4: idtoupdate = input("Enter the user ID : ") found = False keyfound = [] count=0 for i in empList: count+=1 if idtoupdate in i: found = True keyfound = i break if found: name = input("Enter the new name : ") empList[count-1][1]=name else: print("ID not found") elif choice == 5: print("ID\t\tName") for i in empList: print(i[0],i[1]) elif choice == 6: break else: print("Wrong input! ")
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
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.Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education