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

Create a contacts module to meet the following requirements:

2. Create a contacts module to meet the following requirements:
i. Create a file named contacts.py.
ii. Add a comment at the top of the file which indicates your name, date and the purpose of the file.
iii. Note: All contact lists within this module should assume the list is of the form: [["first name","last
name"],["first name", "last name"],...]
iv. Define a function named print_list to meet the following requirements:
a. Take a contact list as a parameter.
b. Implement a docstring with a simple sentence that describes the function.
c. Print a header for the printout which indicates the list index number, the first name, and the last
name column headers.
d. Loop through the contact list and print each contact on a separate line displaying: the list index
number, the contact first name, and the contact last name. Assuming i is the index value and
contacts is the name of the list, the following will format the output: print (f'{str(i):8}
[contacts[1][0]:22}{contacts [1][1]:22}')
v. Define a function named add_contact to meet the following requirements:
a. Take a contact list as a parameter.
b. Implement a docstring with a simple sentence that describes the function.
c. Prompt the user for the first name.
d. Prompt the user for the last name.
e. Add the contact to the list.
f. Return the updated list.
vi. Define a function named modify_contact to meet the following requirements:
a. Take a contact list as a parameter.
b. Implement a docstring with a simple sentence that describes the function.
c. Prompt the user for the list index number to modify. If the index it is not within the range of the
contact list, print out Invalid index number. and return the unedited list.
d. Prompt the user for the first name.
e. Prompt the user for the last name.
f. Modify the contact list at the index value.
g. Return the updated list.
vii. Define a function named delete_contact to meet the following requirements:
a. Take a contact list as a parameter.
b. Implement a docstring with a simple sentence that describes the function.
c. Prompt the user for the list index number to delete. If the index it is not within the range of the
contact list, print out Invalid index number. and return the unedited list.
d. Delete the contact at the index value.
e. Return the updated list.
3. Create a main driver program to meet the following requirements:
i. Create a file named main.py.
ii. Add a comment at the top of the file which indicates your name, date and the purpose of the file.
iii. Import the contacts module.
iv. Define a variable to use for the contact list.
v. Implement a menu within a loop with following choices:
a. Print list
b. Add contact
c. Modify contact
d. Delete contact
e. Exit the program
expand button
Transcribed Image Text:2. Create a contacts module to meet the following requirements: i. Create a file named contacts.py. ii. Add a comment at the top of the file which indicates your name, date and the purpose of the file. iii. Note: All contact lists within this module should assume the list is of the form: [["first name","last name"],["first name", "last name"],...] iv. Define a function named print_list to meet the following requirements: a. Take a contact list as a parameter. b. Implement a docstring with a simple sentence that describes the function. c. Print a header for the printout which indicates the list index number, the first name, and the last name column headers. d. Loop through the contact list and print each contact on a separate line displaying: the list index number, the contact first name, and the contact last name. Assuming i is the index value and contacts is the name of the list, the following will format the output: print (f'{str(i):8} [contacts[1][0]:22}{contacts [1][1]:22}') v. Define a function named add_contact to meet the following requirements: a. Take a contact list as a parameter. b. Implement a docstring with a simple sentence that describes the function. c. Prompt the user for the first name. d. Prompt the user for the last name. e. Add the contact to the list. f. Return the updated list. vi. Define a function named modify_contact to meet the following requirements: a. Take a contact list as a parameter. b. Implement a docstring with a simple sentence that describes the function. c. Prompt the user for the list index number to modify. If the index it is not within the range of the contact list, print out Invalid index number. and return the unedited list. d. Prompt the user for the first name. e. Prompt the user for the last name. f. Modify the contact list at the index value. g. Return the updated list. vii. Define a function named delete_contact to meet the following requirements: a. Take a contact list as a parameter. b. Implement a docstring with a simple sentence that describes the function. c. Prompt the user for the list index number to delete. If the index it is not within the range of the contact list, print out Invalid index number. and return the unedited list. d. Delete the contact at the index value. e. Return the updated list. 3. Create a main driver program to meet the following requirements: i. Create a file named main.py. ii. Add a comment at the top of the file which indicates your name, date and the purpose of the file. iii. Import the contacts module. iv. Define a variable to use for the contact list. v. Implement a menu within a loop with following choices: a. Print list b. Add contact c. Modify contact d. Delete contact e. Exit the program
Expert Solution
Check Mark
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