Lab: Practice Problems I

Basic class definitions

Copy this into a Python file and add the specified code under each comment. For testing purposes, you can comment out working parts as you go (surround the lines with """).

"""
This is how you comment
out a whole block of stuff.
"""

# define a class that holds a contact (as in phonebook). public data members:
# - first name
# - last name
# - phone number
# - phone type (work, home, cel)


# create a contact object and set its data for:
# Emmett Tomai
# 956-665-7229 (work)


# define a function that takes a contact object and prints it in the above format


# test it out!


# define a function that takes two contact objects and returns true if they 
#  have the same phone number, false otherwise


# test it out!


# define a function that takes a list of contact objects and a last name and returns a 
#  list of all contact objects in the list that match that last name


# test it out!


# define a function that takes a list of contact objects and gets information 
#  from the user to create (append) a new contact


# test it out!


# define that point class again here, with
#  data members x and y


# define a function that takes two point objects
#  and returns the distance between them
# (hint: it rhymes with Bythagorean Beorem)


# test that function! print the distance between
#  the points 3.4, 6.7 and -2.1, .4.8