Category Archives: programing

python homework

Programming Homework

Note: As is true of all programming assignments, you must control the user experience. That means you have to prompt the user with useful prompts, check input to make sure its what you want (and will work).

You should follow the python style guide ( (Links to an external site.)) for the most part (not where tabs are concerned). You must have comments that describe what youre doing clearly, and all indentation must be correct and clear (this is the main place that I dramatically disagree with the Python style guide, I believe that you should always use tabs). You should never duplicate code, instead put functionality in functions for clarity, simplicity and ease of debugging.

The intent of this program is to manage a set of contacts. Each contact will have data associated with it:

Id number/integer
First Name string
Last Name string
Age number/integer
Phone Number string
Email string
Gender character (m/f/o)
Anything else youd like to add to make yours unique (can result in extra credit)
You must allow the customer to do the following actions on the contact list:

List all contacts
Add contact
Delete contact
Edit contact
Exit program
You have the code (both yours and mine) from the last homework that you can modify to make it work for this assignment. Please note that in the next HW assignment well hook the code up to a DB to save everything to the DB and read from it. Getting a head start on that is a good idea.

You should use classes for this assignment. This means you should have two classes:

Contact all the attributes/properties described above with appropriate constructor. Methods:
Add (constructor – __init__(p_id, p_fname, p_lname, p_age, p_phone, p_email, p_gender)
Contact List (contact_list) built on Python list (or creating one within the constructor), you should have methods:
Add add a new contact to the list
Edit edit a contact within the list
Delete delete a contact from the list