phonebook = {
"Paul" : 4071234545,
"Joe" : 4074451234,
"Patsy" : 4076645651,
"James" : 2153343434,
"Steve" : 2078823456,
"Heather" : 222234234
}
# write your code
# testing code
if "Melody" in phonebook:
print("Melody is listed in the phonebook.")
if "James" not in phonebook:
print("James is not listed in the phonebook.")
phonebook = {
"Paul" : 4071234545,
"Joe" : 4074451234,
"Patsy" : 4076645651,
"James" : 2153343434,
"Steve" : 2078823456,
"Heather" : 222234234
}
# write your code here
phonebook["Melody"] = 4078823411
del phonebook["James"]
# testing code
if "Melody" in phonebook:
print("Melody is listed in the phonebook.")
if "James" not in phonebook:
print("James is not listed in the phonebook.")
test_output_contains("Melody is listed in the phonebook.",no_output_msg= "You did not add Melody after the comment correctly!.")
test_output_contains("James is not listed in the phonebook.",no_output_msg= "You did not delete James using the del command!.")
success_msg("Nice work!")
Look at the top examples to access and add and remove to dicts!