dict_list={"a":1,"b":2,"c":3}
inverse_dict=dict([val,key] for key,val in dict_list.items())
The for loop statements I have learned all start with for
. I don't understand why there is a list before the keyword for
in this statement, and I don't know how this statement can reverse the key-value pairs of the dictionary.