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[i][0]:22) (contacts[i][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

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
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
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
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY