Reason for your output
for key in my_dict: - This line will make the execute the loop 3 times as there are 3 items in the dictionary.
Now, the line
print "Name", my_dict["Name"] will print “Name” and the value at key
Name. And it is inside the loop, so it will be repeated for three times.
Similarly in each loop statement. So, therefore, your answer is printed 3 times each.
As there are 3 items in your dictionary so the loop is running for three times, so use just 1 loop as follows:
for key in my_dict:
print key, my_dict[key]
key variable will be replaced by “Name”, You" and “Prepare” each time the loop iterates, and you don’t need to write the key values by yourself, as it is impractical in case of a dictionary for some hundreds or thousands of items.