2. Create a contacts module to meet the following requirements: i. Create a file named contacts.py. ii. Add 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

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.5: A Case Study: Pollen Count File Update
Problem 4E
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
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Graphical User Interface
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr