Harold Nelson
9/30/2020
Create a dictionary to record the weights of Joe (175), Tom (190), and Dick (150). Print the dictionary.
## {'Joe': 175, 'Tom': 190, 'Dick': 150}
Add Harry, who weighs 180 pounds to the dictionary and print the new dictionary.
Remove Joe from the dictionary and print the new dictionary.
Use the dict to look up Dick’s weight and print it.
Iterate over the items in the dictionary and calculate the sum of the weights. Print the sum.
Use the method items() to get the items in adict. Print the rti, the object returned by the items() method. What is the type of this object?
## dict_items([('Tom', 190), ('Dick', 150), ('harry', 180.0)])
## <class 'dict_items'>
Can you iterate over rti?
## ('Tom', 190)
## <class 'tuple'>
## ('Dick', 150)
## <class 'tuple'>
## ('harry', 180.0)
## <class 'tuple'>
Can you use an integer index to obtain one of the things in rti?
Can you convert rti to a list using the list() function?