The part of the program defining how option 4 should lookup an existing name and number should be written as follows:
Code:
def lookUpdetails(name):
'''
Retrieves details for 'name'
if they exist.
'''
global number
if not number.has_key(name):
print "Key doesn't exist."
else:
print "Name: %s and Number: %s" % (name, number[name])
In the original program, the word
number which I have bolded is actually written as
key. I think you just looked at "if not
number.has_key(name)" and focused on "
key(name)".
I made the change and tested the program. It works now. I guess there's hope for me yet.
