Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your instructor should provide a CSV file named contacts.csv. When the program starts, it should read the contacts from the CSV file. For

Your instructor should provide a CSV file named contacts.csv.  

When the program starts, it should read the contacts from the CSV file. 

 For the view and del commands, display an error message if the user enters an invalid contact number.  

When you add or delete a contact, the change should be saved to the CSV file immediately. 

That way, no changes are lost, even if the program crashes later.

COMMAND MENU 

list - Display all contacts 

view - View a contact 

add - Add a contact 

del - Delete a contact 

exit - Exit program 

Command: list 

1. Guido van Rossum 

2. Eric Idle 

Command: view 

Number: 2 

Name: Eric Idle 

Email: e..c@ericidle.com 

Phone: +44 20 7946 0958 

Command: add 

Name: Mike Murach 

Email: m..e@murach.com 

Phone: 559-123-4567 

Mike Murach was added. 

Command: list 

1. Guido van Rossum 

2. Eric Idle 

3. Mike Murach 

Command: exit

Bye!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

import csv import os def readcontacts contacts if ospathexistscontactscsv with opencontactscsv moder ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual C# An Introduction to Object-Oriented Programming

Authors: Joyce Farrell

7th edition

978-1337102100

More Books

Students also viewed these Programming questions

Question

What are the default values for static variables?

Answered: 1 week ago

Question

Average Birth LengthAverage Birth WeightAverage Birth Head Circ

Answered: 1 week ago