In the following code, I don't understand the line , print tank_name, tanks[tank_name]. What I'M having trouble with is it seems a little redundant, print thank_name, then thanks(the name of the dictionary), then tank_name again. And why is the second tank_name in "[]" like a list? I can't remember, is that just how you use a dictionary? Thanks for any and all replies.
from tank import Tank
tanks = {"a": Tank("Alice"), "b": Tank("Bob"), "c": Tank("Carol")}
alive_tanks = len(tanks)
while alive_tanks > 1:
print
for tank_name in sorted( tanks.keys() ):
print tank_name, tanks[tank_name]