Write the output of the following program. If a line causes an error, write ERROR at that point in the output and continue on with the program as if the line causing the error had been skipped.
phone_book = {"Wehrwein": 6324}
phone_book["Ahmed"] = 2624
phone_book["Jagodzinski"] = 6160
phone_book["Fizzano"] = 3807
phone_book["Wehrwein"] = 6327
print(phone_book["Wehrwein"])
print(phone_book["Fizzano"])
print(phone_book["Liu"])
print(phone_book.get("Wehrwein"))
print(phone_book.get("Liu", 9999))
print("6327" in phone_book)
print("Wehrwein" in phone_book)
print("Wehrwein" in phone_book.items())
del phone_book["Jagodzinski"]
contents = []
for k in phone_book.keys():
contents.extend([k, phone_book[k]])
print(len(contents))
print(contents[-1])
Implement the following function:
Implement the following function; you may call the function you wrote for Problem 1.
Implement the following function:
Implement the following function:
def same_elements(list1, list2):
"""Return true if list1 and list2 contain exactly the same elements, possibly
in a different order from each other.
Examples: same_elements([1, 2], [1, 2]) => True
same_elements([1, 2], [2, 1]) => True
same_elements([1, 2, 3], [2, 1, 3]) => True
same_elements([1, 2], [2, 2]) => False
same_elements([1, 1, 2], [2, 1, 1]) => True
same_elements([1, 2, 2], [1, 1, 2]) => False
Precondition: list1 and list2 are lists """